fb:porticula NoPaste
wx-c Beispiel für nemored
Uploader: | MOD |
Datum/Zeit: | 19.08.2011 20:29:51 |
#Include "wx-c 0.9.2/wx.bi"
Declare Function App_OnInit WXCALL ( ) As wxBool
Declare Function App_OnExit WXCALL ( ) As wxInt
Declare Sub choice0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub combo0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button1_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Dim Shared As wxApp Ptr wx_app
Dim Shared As wxFrame Ptr wx_frame
Dim Shared As wxPanel Ptr wx_panel
'Global Widgets
Dim Shared As wxChoice Ptr choice0
Dim Shared As wxComboBox Ptr combo0
Dim Shared As wxTextCtrl Ptr textctrl0
Dim Shared As wxTextCtrl Ptr textctrl1
Dim Shared As wxTextCtrl Ptr textctrl2
Function App_OnInit WXCALL ( ) As wxBool
wx_frame = wxFrame_ctor( )
wxFrame_Create( wx_frame, WX_NULL, -1, wxString_ctorUTF8("Change things example"), 441, 59, 369, 139, wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER, WX_NULL )
wx_panel = wxPanel_ctor2( wx_frame, -1, -1, -1, -1, -1, 0, WX_NULL )
''
'' create widget choice0
''
Dim As wxArrayString Ptr choice0_str
choice0_str = wxArrayString_ctor( )
wxArrayString_Add( choice0_str, wxString_ctorUTF8( "select this!" ) )
choice0 = wxChoice_ctor( )
wxChoice_Create( choice0, wx_panel, -1, 10, 10, 100, -1, choice0_str, 0, 0, 0 )
wxEvtHandler_Proxy( choice0, Cast(EventListener, @choice0_event) )
wxEvtHandler_Connect( choice0, wxEvent_EVT_COMMAND_CHOICE_SELECTED( ), -1, -1, 0 )
''
'' create widget combo0
''
Dim As wxArrayString Ptr combo0_str
combo0_str = wxArrayString_ctor( )
wxArrayString_Add( combo0_str, wxString_ctorUTF8( "select this!" ) )
combo0 = wxComboBox_ctor( )
wxComboBox_Create( combo0, wx_panel, -1, wxString_ctorUTF8("combo0"), wxPoint_ctor( 130, 10 ), wxSize_ctor( 100, -1 ), combo0_str, 0, 0, 0 )
wxEvtHandler_Proxy( combo0, Cast(EventListener, @combo0_event) )
wxEvtHandler_Connect( combo0, wxEvent_EVT_COMMAND_COMBOBOX_SELECTED( ), -1, -1, 0 )
''
'' create widget textctrl0
''
textctrl0 = wxTextCtrl_ctor( )
wxTextCtrl_Create( textctrl0, wx_panel, -1, wxString_ctorUTF8("Text"), 250, 10, 100, -1, 0, 0, 0 )
''
'' create widget textctrl1
''
textctrl1 = wxTextCtrl_ctor( )
wxTextCtrl_Create( textctrl1, wx_panel, -1, wxString_ctorUTF8("Choice Text"), 10, 50, 100, -1, 0, 0, 0 )
''
'' create widget textctrl2
''
textctrl2 = wxTextCtrl_ctor( )
wxTextCtrl_Create( textctrl2, wx_panel, -1, wxString_ctorUTF8("Combo Text"), 130, 50, 100, -1, 0, 0, 0 )
''
'' create widget button0
''
Dim As wxButton Ptr button0
button0 = wxButton_ctor( )
wxButton_Create( button0, wx_panel, -1, wxString_ctorUTF8("Choice"), 250, 50, 50, 24, 0, 0, 0 )
wxEvtHandler_Proxy( button0, Cast(EventListener, @button0_event) )
wxEvtHandler_Connect( button0, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
''
'' create widget button1
''
Dim As wxButton Ptr button1
button1 = wxButton_ctor( )
wxButton_Create( button1, wx_panel, -1, wxString_ctorUTF8("Combo"), 300, 50, 50, 24, 0, 0, 0 )
wxEvtHandler_Proxy( button1, Cast(EventListener, @button1_event) )
wxEvtHandler_Connect( button1, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
wxWindow_Show( wx_frame, 1 )
wxApp_OnInit( wx_app )
Return 1
End Function
Function App_OnExit WXCALL ( ) As wxInt
Return wxApp_OnExit( wx_app )
End Function
Sub choice0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Static As Integer cnt = 0
cnt += 1
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_CHOICE_SELECTED
''stuff
wxTextCtrl_SetValue( textctrl1, wxControlWithItems_GetString( choice0, wxChoice_GetCurrentSelection( choice0 ) ) )
wxControlWithItems_Append( choice0, wxString_ctorUTF8("new_item" & cnt) )
End Select
End Sub
Sub combo0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Static As Integer cnt = 0
cnt += 1
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_COMBOBOX_SELECTED
''stuff
wxTextCtrl_SetValue( textctrl2, wxComboBox_GetValue( combo0 ) )
wxControlWithItems_Append( combo0, wxString_ctorUTF8("new_item" & cnt) )
End Select
End Sub
Sub button0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
''stuff
wxTextCtrl_SetValue( textctrl0, wxTextCtrl_GetValue( textctrl1 ) )
End Select
End Sub
Sub button1_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
''stuff
wxTextCtrl_SetValue( textctrl0, wxTextCtrl_GetValue( textctrl2 ) )
End Select
End Sub
''main
wx_app = wxApp_ctor( )
wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit )
wxApp_Run(0, 0)