Home

Add

Edit

Without Linenumbers

Code in Textfield

Download

  1. #INCLUDE "wx-c 0.9.2/wx.bi"
    
  2. 
    
  3. Declare Function App_OnInit WXCALL ( ) As wxBool
    
  4. Declare Function App_OnExit WXCALL ( ) As wxInt
    
  5. Dim Shared As String title,text,button,como
    
  6. 
    
  7. como = Command(0)
    
  8. If como = "1" Then text = "Richtig Geraten":title = "Richtig Geraten, das Programm schließt sich":button = "Okay!":Endif
    
  9. If como = "2" Then text = "Die Zahl ist größer!":title = "Die Zahl..":button = "ok":Endif
    
  10. If como = "3" Then text = "Die Zahl ist kleiner!":title = "Die Zahl..":button = "ok":Endif
    
  11. Declare Sub button0_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  12. 
    
  13. Dim Shared As wxApp Ptr wx_app
    
  14. Dim Shared As wxFrame Ptr wx_frame
    
  15. Dim Shared As wxPanel Ptr wx_panel
    
  16. 
    
  17. Function fbstring_to_wxString( Byval fbstr As String ) As wxString Ptr
    
  18.     
    
  19.     Dim As wxString Ptr ret
    
  20.     Dim As Wstring Ptr temp = Callocate( Len(fbstr) + 1, Sizeof(Wstring) )
    
  21.     
    
  22.     *temp = Wstr( fbstr )
    
  23.     ret = wxString_ctorUTF16( temp )
    
  24.     
    
  25.     Deallocate temp
    
  26.     Return ret
    
  27.     
    
  28. End Function
    
  29. Function App_OnInit WXCALL ( ) As wxBool
    
  30.     
    
  31.     wx_frame = wxFrame_ctor( )
    
  32.     wxFrame_Create( wx_frame, WX_NULL, -1, fbstring_to_wxString((title)), 276, 104, 400, 121, wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER, WX_NULL )
    
  33.     wx_panel = wxPanel_ctor2( wx_frame, -1, -1, -1, -1, -1, 0, WX_NULL )
    
  34.     
    
  35.     ''
    
  36.     '' create widget button0
    
  37.     ''
    
  38.     Dim As wxButton Ptr button0
    
  39.     button0 = wxButton_ctor( )
    
  40.     wxButton_Create( button0, wx_panel, -1, fbstring_to_wxString((button)), 250, 80, -1, 24, 0, 0, 0 )
    
  41.     
    
  42.     wxEvtHandler_Proxy( button0, Cast(EventListener, @button0_event) )
    
  43.     wxEvtHandler_Connect( button0, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
    
  44.     
    
  45.     ''
    
  46.     '' create widget stattext0
    
  47.     ''
    
  48.     Dim As wxStaticText Ptr stattext0
    
  49.     stattext0 = wxStaticText_ctor( )
    
  50.     wxStaticText_Create( stattext0, wx_panel, -1, fbstring_to_wxString((text)), 90, 30, 190, 30, 0, 0 )
    
  51.     
    
  52.     
    
  53.     wxWindow_Show( wx_frame, 1 )
    
  54.     wxApp_OnInit( wx_app )
    
  55.     Return 1
    
  56.     
    
  57. End Function
    
  58. 
    
  59. Function App_OnExit WXCALL ( ) As wxInt
    
  60.     
    
  61.     Return wxApp_OnExit( wx_app )
    
  62.     
    
  63. End Function
    
  64. 
    
  65. Sub button0_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  66.     
    
  67.     Select Case wxEvent_GetEventType( event )
    
  68.         Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
    
  69.             ''stuff
    
  70.             End
    
  71.     End Select
    
  72.     
    
  73. End Sub
    
  74. 
    
  75. 
    
  76. ''main
    
  77. wx_app = wxApp_ctor( )
    
  78. wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit )
    
  79. wxApp_Run( 0, 0 )