Code: Select all
Procedure Quit( )
;\\ stop main loop
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
gtk_main_quit_( )
CompilerCase #PB_OS_Windows
PostQuitMessage_( 0 )
CompilerCase #PB_OS_MacOS
CocoaMessage( 0, CocoaMessage( 0, 0, "NSApplication sharedApplication" ), "stop:", 0 )
CompilerEndSelect
EndProcedure
Procedure Message( Title.s, Text.s, flag.q, *parent )
Protected result
Protected *message = OpenWindow(#PB_Any, 0, 0, 400, 120, Title, #PB_Window_SystemMenu|#PB_Window_WindowCentered, *parent)
BindEvent( #PB_Event_CloseWindow, @Quit(), *message )
; macos bug no post event
PostEvent( #PB_Event_Gadget, 0,0, #PB_EventType_FirstCustomValue )
;\\ start main loop
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Linux
gtk_main_( )
CompilerCase #PB_OS_Windows
Protected msg.MSG
While GetMessage_( @msg, #Null, 0, 0 )
TranslateMessage_( msg )
DispatchMessage_( msg )
Wend
CompilerCase #PB_OS_MacOS
CocoaMessage( 0, CocoaMessage( 0, 0, "NSApplication sharedApplication" ), "run" )
CompilerEndSelect
;\\ close
CloseWindow( *message )
ProcedureReturn result
EndProcedure
;-
Procedure CanvasEvents( )
If EventType() = #PB_EventType_FirstCustomValue
Debug "#PB_EventType_FirstCustomValue "
EndIf
EndProcedure
If OpenWindow( 0, 150, 150, 600, 300, "demo message", #PB_Window_SizeGadget | #PB_Window_SystemMenu )
CanvasGadget(0,10,10,490, 250 )
BindGadgetEvent( 0, @canvasevents() )
Message("Title", "Please make your input:", 0, WindowID(0))
Define Event
Repeat
Event = WaitWindowEvent( )
Until Event = #PB_Event_CloseWindow
EndIf
