Main window goes behind all windows (V1.45 Win)
Archives Forums/MaxGUI Bug Reports/Main window goes behind all windows (V1.45 Win)
| ||
Hello! When I open a window inside a window and then exit it, the main window goes behind all windows which is annoying. I am almost sure it is a bug. Here it is the code: Import MaxGui.Drivers 'open a window Global window:TGadget = CreateWindow( "ZX Life Shield Professional", 100, 100, 640, 480, Null, WINDOW_TITLEBAR|WINDOW_RESIZABLE|WINDOW_MENU|WINDOW_CLIENTCOORDS|WINDOW_CENTER) SetMaxWindowSize(window:TGadget, 640, 480) SetMinWindowSize(window:TGadget, 640, 480) LoadGuiFont:TGuiFont("verdana",13,bold=False,italic=False,underline=False,strikethrough=False) SetGadgetPixmap window:TGadget, image_appicon ' Open and hide window of WORD SPLIT Global window_split_word:TGadget = CreateWindow( "WORD Split", 100, 100, 200+100-10-10, 200-30-40-10-5-5, Null, WINDOW_TITLEBAR|WINDOW_CLIENTCOORDS|WINDOW_HIDDEN|WINDOW_CENTER) LoadGuiFont:TGuiFont("verdana",13,bold=False,italic=False,underline=False,strikethrough=False) SetGadgetPixmap window_split_word:TGadget, image_appicon CreateLabel("Which value to split (0-65535)?",20,20-5-2,240,16+4,window_split_word) Global name_split_word=CreateTextField:TGadget(20,20-5-2+20,140-10,16+4,window_split_word) Global okay_button_split_word:TGadget=CreateButton("OK",20,20-5-2+20+20+10,40-3+15,16+4,window_split_word,BUTTON_OK) Global cancel_button_split_word:TGadget=CreateButton("Cancel",20+50+10,20-5-2+20+20+10,40-3+15,16+4,window_split_word,BUTTON_CANCEL) ActivateWindow window ' Show window of WORD SPLIT DisableGadget window ShowGadget window_split_word ActivateGadget name_split_word split_word() HideGadget window_split_word EnableGadget window ' Wait for a key and then exit Print "Press ESCAPE to exit" Repeat Until KeyDown(KEY_ESCAPE) End Function split_word() Repeat WaitEvent() t = EventID() ' CLOSE WINDOW If t = EVENT_WINDOWCLOSE Return EndIf ' CANCEL If EventSource()=cancel_button_split_word Return EndIf ' OKAY If EventSource()=okay_button_split_word flag=0 If Len(GadgetText(name_split_word))=0 AppTitle="Warning" Notify "Value missing!", True flag=1 EndIf If flag=0 v=Int(GadgetText(name_split_word)) If v<0 Or v>65535 AppTitle="Warning" Notify "Value out of range!", True flag=1 EndIf EndIf If flag=0 v1=Int(v/256) v2=v-256*Int(v/256) Print "WORD "+String(v)+" in the ZX Spectrum is ("+String(v2)+","+String(v1)+")" Return flag=1 EndIf EndIf Forever End Function Thanks! Kind regards, >Marco A.G.Pinto -------------------- |
| ||
Here you go: You do kill the focus of the mainwindow and enabling a gadget does not give focus again. |
| ||
Thanks! I will try it in the morning. It is 1am and I am dead tired. Kind regards, >Marco A.G.Pinto -------------------- |
| ||
@jsp Sorry to bother again. I tried the code you suggested and my main window still goes behind windows on the desktop. I am using V1.45 on Windows 7 x64. Thanks! Kind regards, >Marco A.G.Pinto -------------------- |
| ||
@jsp I was able to fix the bug by placing inside the function just before the RETURNs: EnableGadget window ActivateGadget window ActivateWindow window But, why doesn't it work in the main body of my utility? It is strange... Kind regards, >Marco A.G.Pinto -------------------- |
| ||
Did you change your escape code to the one I have provided in my example? |
| ||
Buaaaaaaaaaaaaaaa.... I don't know about the escape code. But I found that the workaround I mentioned above does what I wanted. Thanks! Kind regards, |