Home

Add

Edit

Without Linenumbers

Code in Textfield

Download

  1. #INCLUDE "wx-c 0.9.2/wx.bi"
    
  2. Randomize ,3
    
  3. Dim Shared As Integer ratzahl
    
  4. ratzahl = Int(Rnd * 10)
    
  5. Dim Shared As Integer probiert
    
  6. Declare Function App_OnInit WXCALL ( ) As wxBool
    
  7. Declare Function App_OnExit WXCALL ( ) As wxInt
    
  8. Declare Sub button0_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  9. Declare Sub button1_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  10. Dim Shared As wxApp Ptr wx_app
    
  11. Dim Shared As wxFrame Ptr wx_frame
    
  12. Dim Shared As wxPanel Ptr wx_panel
    
  13. Dim Shared As wxTextCtrl Ptr textctrl0
    
  14. '----'
    
  15. 'have modd writtened'
    
  16. Function wxString_to_fbstring( Byval wxstr As wxString Ptr ) As String
    
  17.     
    
  18.     Dim As String ret
    
  19.     Dim As Integer i
    
  20.     
    
  21.     For i = 0 To wxString_GetLength( wxstr )
    
  22.         If wxString_CharAtUTF16( wxstr, i ) <> 0 Then
    
  23.             ret += Chr( wxString_CharAtUTF16( wxstr, i ) )
    
  24.         Endif
    
  25.     Next
    
  26.     
    
  27.     Return ret
    
  28.     
    
  29. End Function
    
  30. Function fbstring_to_wxString( Byval fbstr As String ) As wxString Ptr
    
  31.     
    
  32.     Dim As wxString Ptr ret
    
  33.     Dim As Wstring Ptr temp = Callocate( Len(fbstr) + 1, Sizeof(Wstring) )
    
  34.     
    
  35.     *temp = Wstr( fbstr )
    
  36.     ret = wxString_ctorUTF16( temp )
    
  37.     
    
  38.     Deallocate temp
    
  39.     Return ret
    
  40.     
    
  41. End Function
    
  42. '-----'
    
  43. 'WX Createt'
    
  44. Function App_OnInit WXCALL ( ) As wxBool
    
  45.     
    
  46.     wx_frame = wxFrame_ctor( )
    
  47.     wxFrame_Create( wx_frame, WX_NULL, -1, wxString_ctorUTF8(("darkrate 0.1")), 310, 145, 485, 96, wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER, WX_NULL )
    
  48.     wx_panel = wxPanel_ctor2( wx_frame, -1, -1, -1, -1, -1, 0, WX_NULL )
    
  49.     
    
  50.     ''
    
  51.     '' create widget textctrl0
    
  52.     ''
    
  53.     textctrl0 = wxTextCtrl_ctor( )
    
  54.     wxTextCtrl_Create( textctrl0, wx_panel, -1, wxString_ctorUTF8(("0")), 20, 30, 380, 30, 0, 0, 0 )
    
  55.     
    
  56.     
    
  57.     ''
    
  58.     '' create widget stattext2
    
  59.     ''
    
  60.     Dim As wxStaticText Ptr stattext2
    
  61.     stattext2 = wxStaticText_ctor( )
    
  62.     wxStaticText_Create( stattext2, wx_panel, -1, wxString_ctorUTF8(("Bitte Geben sie eine Zahl zwischen 1 und 10 ein")), 30, 10, 320, 17, 0, 0 )
    
  63.     
    
  64.     
    
  65.     ''
    
  66.     '' create widget button0
    
  67.     ''
    
  68.     Dim As wxButton Ptr button0
    
  69.     button0 = wxButton_ctor( )
    
  70.     wxButton_Create( button0, wx_panel, -1, wxString_ctorUTF8(("Raten!")), 380, 70, -1, 24, 0, 0, 0 )
    
  71.     
    
  72.     wxEvtHandler_Proxy( button0, Cast(EventListener, @button0_event) )
    
  73.     wxEvtHandler_Connect( button0, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
    
  74.     
    
  75.     ''
    
  76.     '' create widget button1
    
  77.     ''
    
  78.     Dim As wxButton Ptr button1
    
  79.     button1 = wxButton_ctor( )
    
  80.     wxButton_Create( button1, wx_panel, -1, wxString_ctorUTF8(("Beenden")), 20, 70, -1, 24, 0, 0, 0 )
    
  81.     
    
  82.     wxEvtHandler_Proxy( button1, Cast(EventListener, @button1_event) )
    
  83.     wxEvtHandler_Connect( button1, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
    
  84.     
    
  85.     wxWindow_Show( wx_frame, 1 )
    
  86.     wxApp_OnInit( wx_app )
    
  87.     Return 1
    
  88.     
    
  89. End Function
    
  90. 
    
  91. Function App_OnExit WXCALL ( ) As wxInt
    
  92.     
    
  93.     Return wxApp_OnExit( wx_app )
    
  94.     
    
  95. End Function
    
  96. 
    
  97. Sub button0_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  98.     Dim As Integer Vara
    
  99.     Select Case wxEvent_GetEventType( event )
    
  100.         Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
    
  101.             ''stuff
    
  102.             probiert += 1
    
  103.             Vara  = Valint(wxString_to_fbstring(wxTextCtrl_GetValue(textctrl0)))
    
  104.             If ratzahl > Vara Then Shell("./MessageBox 2"):Endif
    
  105.             If ratzahl < Vara Then Shell("./MessageBox 3"):Endif
    
  106.             If ratzahl = Vara Then 
    
  107.                 Print "Richtig Geraten!Du hast "&Str(probiert)&" versuch(e) gebraucht."
    
  108.                 Shell("./MessageBox 1")
    
  109.             Endif
    
  110.             
    
  111.     End Select
    
  112.     
    
  113. End Sub
    
  114. 
    
  115. Sub button1_event WXCALL ( Byval event As wxEvent Ptr, Byval iListener As wxInt )
    
  116.     
    
  117.     Select Case wxEvent_GetEventType( event )
    
  118.         Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
    
  119.             ''stuff
    
  120.             End
    
  121.     End Select
    
  122.     
    
  123. End Sub
    
  124. 
    
  125. 
    
  126. ''main
    
  127. wx_app = wxApp_ctor( )
    
  128. wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit )
    
  129. wxApp_Run( 0, 0 )