Preview image in Load dialog
by Leslie Young · 04/08/2003 (1:41 pm) · 3 comments
Here is something you guys might find usefull when selecting images in the load dialog in the editor. I changed the Dialog to show th actual image for the selected file so you have a little
preview :)
Really easy, have a look.
In common/ui/LoadFileDlg.gui
Add the parts in BOLD:
Note that it would be best to open the GUI editor (F10), open loadFileDlg, and move the new IMAGE control until it's in a nice position, you will see from the above code that some of my controls sits on different positions than the original as I needed to make the load dialog bigger to make
space for the new image control, and skin support I have build in.
preview :)
Really easy, have a look.
In common/ui/LoadFileDlg.gui
Add the parts in BOLD:
//--- OBJECT WRITE BEGIN ---
new GuiControl(LoadFileDlg) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "0 0";
extent = "640 480";
minExtent = "8 8";
visible = "1";
helpTag = "0";
...
new GuiButtonCtrl() {
profile = "GuiButtonProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "250 322";
extent = "100 30";
minExtent = "8 8";
visible = "1";
command = "Canvas.popDialog(LoadFileDlg);";
helpTag = "0";
text = "Cancel";
groupNum = "-1";
buttonType = "PushButton";
};
[bold]
new GuiBitmapCtrl(previewImage) {
profile = "GuiDefaultProfile";
horizSizing = "right";
vertSizing = "bottom";
position = "327 52";
extent = "126 119";
minExtent = "8 8";
visible = "1";
helpTag = "0";
wrap = "0";
};
[/bold]
};
};
//--- OBJECT WRITE END ---
[bold]
// this will set the selected image (IF IT's AN IMAGE!!!!)
// the LoadFile gui can load other stuff too, like map files!
function loadFileList::onSelect(%this)
{
%fn = %this.getRowTextById(%this.getSelectedId());
if (fileExt(%fn)$=".png" || fileExt(%fn)$=".jpg")
previewImage.setBitmap(%fn);
}
[/bold]Note that it would be best to open the GUI editor (F10), open loadFileDlg, and move the new IMAGE control until it's in a nice position, you will see from the above code that some of my controls sits on different positions than the original as I needed to make the load dialog bigger to make
space for the new image control, and skin support I have build in.
About the author
Recent Blogs
• TGEA GroundCover Terrain Surface Reference• Still around
• KBM update
• Finally some updates
• KBM.. More update

SPU9
Can you plz tell me how i can make a script who load the .ter files from the server (the map files to my computer)
(i am a german boy and i play the old realmwars build)
plz help me someone