Child Windows (MaxGui)
BlitzMax Forums/BlitzMax Programming/Child Windows (MaxGui)
| ||
| HI all, I've created a popup window within another window (MDI style) but i want it so focus is fixed on the new window and the user cant go back to the main window until closing the front window, i thought maybe flag WINDOW_CHILD may do it but no :( n e ideas? |
| ||
| cant u just disable the other window and then when the child window is closed just enable it again. |
| ||
| some variation of this might work: http://www.blitzbasic.com/Community/posts.php?topic=56501 |
| ||
| Perfect Mr Shaver thanks :D |
| ||
| note that you should disable any menus in other windows because they will still respond. |
| ||
| am i right in thinking that bmax ide was made with maxgui? if so i wonder how they did it with the syncmod dialog? |
| ||
| you get the source to bmax ide with blitzmaxGUI so why not look for yourself. |
| ||
| i did?? wow...lol |
| ||
as far as i make out its all done with disable gadgetType tapp
Field mwindow:tgadget
Field pwindow:tgadget
Field sbutton:Tgadget
Method New()
mwindow = CreateWindow("main window", 0, 0, ClientWidth(Desktop()), ClientHeight(Desktop()))
MaximizeWindow mwindow
pwindow = CreateWindow("Popup", 100, 100, 200, 200, Null, 65)
HideGadget pwindow
sbutton = CreateButton("popup", 10, 10, 100, 20, mwindow)
End Method
End Type
Global mapp:tapp = New tapp
While True
WaitEvent
Select EventID()
Case event_windowclose
Select EventSource()
Case mapp.mwindow
End
Case mapp.pwindow
EnableGadget mapp.mwindow
HideGadget mapp.pwindow
End Select
Case event_gadgetaction
If EventSource() = mapp.sbutton Then
DisableGadget(mapp.mwindow)
ShowGadget(mapp.pwindow)
EndIf
End Select
Wend |
| ||
| OK....been playin with code from another post and i can make a second window appear thats always in front. however it requires me to click the menu option twice to get the menu to appear in the first place: Type TNWorderWin Field Window:TGadget = CreateWindow("new window",0,0,640,480,Null,WINDOW_TITLEBAR|WINDOW_STATUS|WINDOW_MENU) Field RegWin:TGadget Field FileMnu:TGadget = CreateMenu ("&File",0,WindowMenu(window)) Field HelpMnu:TGadget = CreateMenu ("&Help",0,WindowMenu(window)) Method New() CreateMenu("&About",101,HelpMnu) CreateMenu("&Register",102,FileMnu,KEY_R,MODIFIER_COMMAND) CreateMenu("&Exit",103,FileMnu,KEY_E,MODIFIER_COMMAND) AddHook EmitEventHook,eventhook,Self UpdateWindowMenu Window EndMethod Function eventhook:Object(id:Int,data:Object,context:Object) If TNWorderWin(context) Then TNWorderWin(context).OnEvent TEvent(data) Return data EndFunction Method Delete() RemoveHook EmitEventHook,eventhook FreeGadget(window) EndMethod Method OnEvent(event:TEvent) Select event.id Case EVENT_WINDOWCLOSE Select Event.Source Case window FreeGadget(window) End Case RegWin FreeGadget (RegWin) End Select Case EVENT_GADGETACTION Select Event.Source EndSelect Case EVENT_GADGETPAINT Select Event.Source EndSelect Case EVENT_MENUACTION Select EventData() Case 103 End Case 101 RegWin = CreateWindow("Register",0,0,320,240,Window,WINDOW_TITLEBAR) ActivateGadget RegWin EndSelect EndSelect EndMethod EndType Global App:TNWorderWin= New TNWorderWin While True WaitEvent() Wend |
| ||
| couldnt figure out what yo wanted at first but is this it. cant think way you version dont work. EDIT better version IMO |
| ||
| yeah, thats alot better :) Thank Diablo, not sure why mine went pear shaped :) |