I have this application with a parent window as background. It has a menu that links to several other child windows. This works fine.
On the child windows that are in seperate modules there's a closebutton. And that works fine too.
But when I want to use the closebutton on the system menu of a child window, then this closes all the child windows.
Can this be solved in any way?
Thanks in advance
Rudi
Parent window:
Code: Select all
;
; ------------------------------------------------------------
;
; Multiform application
;
; ------------------------------------------------------------
IncludeFile "Macros_forms.sbi" ; DeclareModule short, and other Macro's for forms
; Macro Includeform(formName_)
; DeclareModule formName_ ; DeclareModule is the module public items (here only 2 functions)
; Declare Open(ParentWindow)
; Declare Close()
; EndDeclareModule
; EndMacro
; Add forms
Includeform(FindWindow) ; Makes DeclareModule short
IncludeFile "FindWindow.sb" ; Add the form
Includeform(frmWindow1)
IncludeFile "frmWindow1.sb"
Includeform(frmKlanten)
IncludeFile "frmKlanten.sb"
Includeform(frmKassa)
IncludeFile "frmKassa.sb"
Includeform(frmInschatting)
IncludeFile "frmInschatting.sb"
Includeform(frmMarketing)
IncludeFile "frmMarketing.sb"
; The (background) / Application window
;
DeclareModule MainWindow
Declare Open()
Declare Close()
EndDeclareModule
Module MainWindow
Global Window
Procedure OnFind()
FindWindow::Open(Window)
EndProcedure
Procedure Open_frmWindow1()
frmWindow1::Open(Window)
EndProcedure
Procedure Open_frmKlanten()
frmKlanten::Open(Window)
EndProcedure
Procedure Open_frmKassa()
frmKassa::Open(Window)
EndProcedure
Procedure Open_frmInschatting()
frmInschatting::Open(Window)
EndProcedure
Procedure Open_frmMarketing()
frmMarketing::Open(Window)
EndProcedure
Procedure OnShortcut()
Debug "Shortcut main: " + EventMenu()
EndProcedure
Procedure Open()
Window = OpenWindow(#PB_Any, 10, 10, 500, 310, "Business center",#PB_Window_Background) ; stays on the background
If CreateMenu(0, WindowID(Window)) ; here the menu creating starts....
MenuTitle("Kassa")
MenuItem(1, "Open")
MenuItem(2, "Window1")
MenuItem(4,"Kassa")
MenuBar() ; here the separator bar will be inserted
MenuTitle("Klanten")
MenuItem(3,"Klanten")
MenuTitle("Inschatting")
MenuItem(5,"Inschatting")
MenuTitle("Marketing")
MenuItem(6,"Marketing")
EndIf
BindMenuEvent(0,1,@Onfind())
BindMenuEvent(0,2,@Open_frmWindow1())
BindMenuEvent(0,3,@Open_frmKlanten())
BindMenuEvent(0,4,@Open_frmKassa())
BindMenuEvent(0,5,@Open_frmInschatting())
BindMenuEvent(0,6,@Open_frmMarketing())
EndProcedure
Procedure Close()
CloseWindow(Window)
EndProcedure
EndModule
; Open the main window
;
MainWindow::Open()Code: Select all
Module frmKlanten ; Everything here is private to the module, so we can reuse the same variable names
Global Window, CloseButton, lstKlanten
Procedure OnClose()
Close()
EndProcedure
Procedure Open(ParentWindow)
If Not IsWindow(Window)
Window = OpenWindow(#PB_Any, 10, 30, 320, 580, "Klanten", #PB_Window_SizeGadget|#PB_Window_SystemMenu, WindowID(ParentWindow))
CloseButton = ButtonGadget(#PB_Any, 10, 50, 100, 30, "Close")
lstKlanten = ListIconGadget(#PB_Any, 10, 100,300,300,"",0,#PB_ListIcon_GridLines)
BindGadgetEvent(CloseButton, @OnClose())
BindEvent(#PB_Event_CloseWindow,@OnClose())
Else
SetActiveWindow(Window)
EndIf
EndProcedure
Procedure Close()
CloseWindow(Window)
EndProcedure
EndModule