Game Development Community

dev|Pro Game Development Curriculum

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:

//--- 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.

#1
04/13/2003 (7:42 pm)
Hi

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
#3
11/18/2007 (3:48 pm)
It's a very old resource but really a nice idea... strangely it seems not many people look at this...
Trying to implement it in TGEA without success... it doesn't show the image...
Any idea?