I can't figure out how it works with SpiderBasic to use images. There are examples, they work but I don't know why.
You need to load them first and then also register the loading? But I don't get it to work inside a module.
Thanks in advance
Rudi
Code: Select all
DeclareModule frmKlanten ; DeclareModule is the module public items (here only 2 functions)
Declare Open(ParentWindow)
EndDeclareModule
Module frmKlanten ; Everything here is private to the module, so we can reuse the same variable names
Global Window, ObjectId
Declare Close()
Procedure Loading(Type, Filename$, ObjectId)
LoadImage(0, "SpiderBasicKlein.png")
EndProcedure
Procedure Open(ParentWindow)
If Not IsWindow(Window)
Window = OpenWindow(#PB_Any, 10, 30, 600, 500, "Klanten", #PB_Window_SystemMenu|#PB_Window_SizeGadget, WindowID(ParentWindow))
;add a button with an image???
Loading(#PB_Loading_Image,"SpiderBasicKlein.png",0)
;LoadImage(0, "SpiderBasicKlein.png")??
ButtonImageGadget(#PB_Any,10,10,10,10,ImageID(0))
BindEvent(#PB_Event_CloseWindow,@Close(),Window)
Else
SetActiveWindow(Window)
EndIf
EndProcedure
Procedure Close()
CloseWindow(Window)
EndProcedure
Procedure LoadingError(Type, Filename$, ObjectId)
Debug Filename$ + ": loading error" ; gives the error!!
EndProcedure
; Register the loading event before calling any resource load command
BindEvent(#PB_Event_Loading, @Loading())
BindEvent(#PB_Event_LoadingError, @LoadingError())
EndModuleCode: Select all
;add the child windows to the compiler
IncludeFile "frmKlanten.sb"
;-----------------------------
; The (background) / Application window
;
DeclareModule MainWindow
Declare Open()
Declare Close()
EndDeclareModule
Module MainWindow
Global Window
; procedures to open the windows
Procedure Open_frmKlanten()
frmKlanten::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
; create the menu
If CreateMenu(0, WindowID(Window)) ; here the menu creating starts....
MenuTitle("Klanten")
MenuItem(3,"Klanten")
EndIf
BindMenuEvent(0,3,@Open_frmKlanten())
EndProcedure
Procedure Close()
CloseWindow(Window)
EndProcedure
EndModule
;---------------------------------
; Open the main window
;
MainWindow::Open()