Dialog wanders when shown repeatedly
- Posted by Tony Bohm <tbohm0 at gmai?.co?> Jan 18, 2008
- 636 views
Hello ;D I'm trying to get into programming again after a very long hiatus, and am running into a problem too simple to wrap my head around XD I've defined two windows with the create() function; one of which is intended to be the main window, and the other will be called in a button-click handler as the need arises. Depending on the button clicked, setText is used to give this secondary window the appropriate title (works OK), and a text label is created to My code looks like this: include win32lib.ew without warning --Main program window constant MainWin = create(Window, "etS beta 0.0", 0, Default, Default, 100, 100, {WS_DLGFRAME, WS_SYSMENU, WS_MINIMIZEBOX}) --Secondary message window/dialogue constant MsgWin = create(Window, "", MainWin, 200, 200, 100, 100, {WS_DLGFRAME, WS_SYSMENU}) --Button click handler procedure ButClick(integer self, integer event, sequence parms) atom hTemp if self=hHistBut then setClientRect(MsgWin, 150, 150) setText(MsgWin, "History..") hTemp = create(CText, "Blahblahblah", MsgWin, 0, 0, 150, 150, 0) openDialog(MsgWin) elsif self=hAboutBut then setClientRect(MsgWin, 150, 150) setText(MsgWin, "About") hTemp = create(CText, "Blarghblargh", MsgWin, 0, 0, 150, 150, 0) openDialog(MsgWin) end if end procedure global procedure IntroScreen() atom hSplash, hTrim hSplash = create(Bitmap, ImageSource & "starmap.bmp", MainWin, 0, 0, 668, 546, 0) hTrim = create(Bitmap, ImageSource & "startrim.bmp", MainWin, 668, 0, 60, 486, 0) hStoryBut = create(PictureButton, {"", "History"}, MainWin, 668, 486, 60, 30, ImageSource & "storybut.bmp") hAboutBut = create(PictureButton, {"", "About"}, MainWin, 668, 516, 60, 30, ImageSource & "aboutbut.bmp") setHandler({hHistBut, hAboutBut}, w32HClick, routine_id("ButClick")) setFocus(hStoryBut) end procedure global procedure main() setClientRect(MainWin, 728, 546) IntroScreen() end procedure