View Full Version : DialogEX and Image.Load troubles.
Animl
12-25-2008, 07:44 PM
I made a dialog using DialogEX. It has an image, that I use as an icon, that changes depending on the information viewed. The image file name is passed via a table from a page of the app and loaded bia the Image.Load event.
With the Image.Load script placed in "On Show" page, in "Preview" it works perfectly. After "Build" it does not work at all.
The default image is there, but it will not load a different image on show.
I intensionally placed a Dialog message before the Image.Load script to see if the table was still passing the image name. After Build, the dialog does in fact report that the image name is making it to the Image.Load event. But nothing happens.
Input.SetText("DlgTxt_Input", tDlgTxt.Msg);
Dialog.Message("Notice", tDlgTxt.IcnImg, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Image.Load("Icon_Img", "AutoPlay\\Images\\"..tDlgTxt.IcnImg);
I also know the data is making it there as the message sent is shown in an input.
Is this a known issue?
Does there happen to be a work-around that I am not aware of?
Am I doing something wrong?
Just to be clear, the Image.Load event works in "Preview" perfectly after "Build" it does not load a differrent image.
Thanks in adavnce.
Animl
Dermot
12-25-2008, 08:34 PM
Try this
Image.Load("Icon_Img", _SourceFolder.."\\AutoPlay\\Images\\"..tDlgTxt.IcnImg)
Animl
12-26-2008, 06:04 AM
Thanks for the effort, but no that doesn't work either. I tried it earlier and tried it again after you posted just to be sure.
Animl
Dermot
12-26-2008, 06:25 AM
Maybe if you post your project or an example showing the problem, someone might be able to help. It hard to know based on 3 lines of code.
Animl
12-26-2008, 03:49 PM
[QUOTE=Dermot;132686]Maybe if you post your project or an example showing the problem, someone might be able to help. It hard to know based on 3 lines of code.[/QUOT
OK
At many places in the app it will create a table below.
tDlg = {};
tDlg["Title"] = sTitle;
tDlg["Msg"] = sSoftTxtTag..sDlgTtl.."\r\n\r\n"..sMsg;
tDlg["IcnImg"] = sIcon;
Application.SetDialogProperties("Dialog1", {DialogTitle = sDlgTtl});
It then opens the dialog. Title, Msg are all passed properly, and show the text when the dialog opens. This is what happens in the dialog on show.
Image.Load("Icon_Img", _SourceFolder.."\\AutoPlay\\Images\\"..tDlg.IcnImg);
Label.SetText("DlgTitle_Lbl", tDlg.Title);
Input.SetText("DlgText_Input", sSoftTxtTag..tDlg.DlgTitle..":\r\n\r\n"..tDlg.Title.."\r\n"..tDlg.Msg);
All text shows during Preview and after Build. The icon image shows during preview, but will not load after build, not in any situation I have so far. There are several different setups for different dialogs. NONE of them will load the image after build.
The dialog message I use is just for testing to make sure the table of info is making it there.
Is it a DialogEx or Load.image bug on build maybe?
Dermot
12-26-2008, 04:21 PM
Where is sIcon being set and what is it set to?
Animl
12-26-2008, 08:03 PM
Where is sIcon being set and what is it set to?
Both the sIcon and the sMsg is set in many places depending. The problem, or lack of is,..using the dialog.message, not to be confused with the DialogEx, it confirms the Icon Image name IS making it to it's desitnation when fired, the end result of the table in the DialogEx window....it makes it all the way to the Load.Image script, except nothing happens. In Preview it works, after build it does not.
There are many many places where the table(s) for the DialogEx's,it's a huge app, what ever is happening is after the fact of creation...IMO. Like I said, when I use the simple Dialog.Message to confirm, it shows everything (text) being passed and displayed, it's just nothing happens to the image.
God bless you if you find something I am missing,.. it just doesn't make sense that it works in Preview but not Build. Just FYI, no directories or files are different then the normal layout of AMS, everything is in it's proper folder.
I know you're real good with this stuffff. The only thing I can think of is there is a bug between the Load.Image and the DialogEx, after build. <shrug> I dunno, I always use this place as last resort, just because I don't like being a PITA. :)
Ulrich
12-26-2008, 10:11 PM
When you say that the image doesn't show "after build", what do you mean exactly? What are your build settings, are you exporting to a HD folder, do you build a web/mail executable, or do you burn a CD/DVD?
I ask this because the file system of a CD/DVD is not the same as on the hard disk, and you may have trouble loading images if the names you use are unusually long, or are placed in multiple subfolders. If this is the case, try to shorten the names of the folders and images to the 8.3 format, and see if this helps.
Otherwise, you could shrink your project to the minimum required to replicate the error and attach it here, or log to the customer portal (see link at the top of this page) and create a support ticket.
Ulrich
Animl
12-26-2008, 11:18 PM
When you say that the image doesn't show "after build", what do you mean exactly? What are your build settings, are you exporting to a HD folder, do you build a web/mail executable, or do you burn a CD/DVD?
I ask this because the file system of a CD/DVD is not the same as on the hard disk, and you may have trouble loading images if the names you use are unusually long, or are placed in multiple subfolders. If this is the case, try to shorten the names of the folders and images to the 8.3 format, and see if this helps.
Otherwise, you could shrink your project to the minimum required to replicate the error and attach it here, or log to the customer portal (see link at the top of this page) and create a support ticket.
Ulrich
Attached is a zip file containing the files.
Build settings are;
Build & Pulblish Target = "Hard drive folder"
Options = "Timestamp files" and "Rename resource files"
I did in fact test build this raw project and got the same exact results,... on this end.
I hope it's just idiocy on my end, which means quick fix. :)
Thanks
Animl
Dermot
12-26-2008, 11:42 PM
Your problem is the renaming of resources at build time. This from the help explains it.
If a resource is referenced from an external Lua file, it's reference may not be changed causing it to fail at runtime.
If a resource file path is composed of variables that are concatenated together to form a path to a resource file, the file may not be found.
You are building the path to the image with variable, but your variable is set to the original file name. When AMS renames the images, the path is no longer valid. I stopped using the Rename Resources option a long time ago because of this kind of thing. It's not a bug or anything like that, it makes perfect sense, you just have to be aware of it.
Animl
12-27-2008, 12:01 AM
Your problem is the renaming of resources at build time. This from the help explains it.
You are building the path to the image with variable, but your variable is set to the original file name. When AMS renames the images, the path is no longer valid. I stopped using the Rename Resources option a long time ago because of this kind of thing. It's not a bug or anything like that, it makes perfect sense, you just have to be aware of it.
I was eyeing the Rename resource files thing, because me bones told me to. But iI didn't "get it" or understand why until you showed me.
You're a gem dude. Disabling that option on build solved it. The second I read the text you posted (which I should have found myself) it instantly made sense. Before I even changed anything I knew you were right.
I've been working on this project for a good while, kinda like a crossword puzzle habit. But I didn't actually build it until recently.
Sometimez I just need another set of eyes.
Thanks again.
Animl
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.