Buchempfehlung
MySQL kurz & gut
MySQL kurz & gut
Das preiswerte Taschen- buch stellt MySQL-rele- vante Inhalte systematisch und knapp dar, sodass es sich optimal zum Nach- schlagen beim Pro- grammieren eignet. [Mehr Infos...]
FreeBASIC-Chat
Es sind Benutzer im FreeBASIC-Chat online.
(Stand:  )
FreeBASIC bei Twitter
Twitter FreeBASIC-Nachrichten jetzt auch über Twitter erhalten. Follow us!

fb:porticula NoPaste

Info
Info / Hilfe
Liste
Übersicht / Liste
Neu
Datei hochladen
Suche
Quellcode suchen
Download
Dateidownload

Visual WX-C Designer - Taschenrechner Beispiellösung

Uploader:MitgliedAffemitwaffel
Datum/Zeit:20.08.2012 12:45:22

#Include "wx-c/wx.bi"

Declare Function App_OnInit WXCALL ( ) As wxBool
Declare Function App_OnExit WXCALL ( ) 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 )
Declare Sub button2_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button3_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button4_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button5_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button6_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button7_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button8_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button9_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button11_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button12_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button13_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button15_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
Declare Sub button14_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

Declare Function Rechnen (Art As String , Zahl As Integer , Zahl2 As Integer) As String

Dim Shared As wxApp Ptr wx_app
Dim Shared As wxFrame Ptr wx_frame
Dim Shared As wxPanel Ptr wx_panel


Dim Shared As wxTextCtrl Ptr textctrl0
Dim Shared As String Eingabe
Dim Shared As Integer Zahl1
Dim Shared As String Art

Function App_OnInit WXCALL ( ) As wxBool

    wx_frame = wxFrame_ctor( )
    wxFrame_Create( wx_frame, WX_NULL, -1, wxString_ctorUTF8("My WX-C Project"), 325, 91, 400, 400, 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 button0
    ''
    Dim As wxButton Ptr button0
    button0 = wxButton_ctor( )
    wxButton_Create( button0, wx_panel, -1, wxString_ctorUTF8("0"), 130, 190, 30, 30, 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("1"), 90, 70, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button1, Cast(EventListener, @button1_event) )
    wxEvtHandler_Connect( button1, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button2
    ''
    Dim As wxButton Ptr button2
    button2 = wxButton_ctor( )
    wxButton_Create( button2, wx_panel, -1, wxString_ctorUTF8("2"), 130, 70, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button2, Cast(EventListener, @button2_event) )
    wxEvtHandler_Connect( button2, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button3
    ''
    Dim As wxButton Ptr button3
    button3 = wxButton_ctor( )
    wxButton_Create( button3, wx_panel, -1, wxString_ctorUTF8("3"), 170, 70, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button3, Cast(EventListener, @button3_event) )
    wxEvtHandler_Connect( button3, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button4
    ''
    Dim As wxButton Ptr button4
    button4 = wxButton_ctor( )
    wxButton_Create( button4, wx_panel, -1, wxString_ctorUTF8("4"), 90, 110, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button4, Cast(EventListener, @button4_event) )
    wxEvtHandler_Connect( button4, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button5
    ''
    Dim As wxButton Ptr button5
    button5 = wxButton_ctor( )
    wxButton_Create( button5, wx_panel, -1, wxString_ctorUTF8("5"), 130, 110, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button5, Cast(EventListener, @button5_event) )
    wxEvtHandler_Connect( button5, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button6
    ''
    Dim As wxButton Ptr button6
    button6 = wxButton_ctor( )
    wxButton_Create( button6, wx_panel, -1, wxString_ctorUTF8("6"), 170, 110, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button6, Cast(EventListener, @button6_event) )
    wxEvtHandler_Connect( button6, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button7
    ''
    Dim As wxButton Ptr button7
    button7 = wxButton_ctor( )
    wxButton_Create( button7, wx_panel, -1, wxString_ctorUTF8("7"), 90, 150, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button7, Cast(EventListener, @button7_event) )
    wxEvtHandler_Connect( button7, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button8
    ''
    Dim As wxButton Ptr button8
    button8 = wxButton_ctor( )
    wxButton_Create( button8, wx_panel, -1, wxString_ctorUTF8("8"), 130, 150, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button8, Cast(EventListener, @button8_event) )
    wxEvtHandler_Connect( button8, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button9
    ''
    Dim As wxButton Ptr button9
    button9 = wxButton_ctor( )
    wxButton_Create( button9, wx_panel, -1, wxString_ctorUTF8("9"), 170, 150, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button9, Cast(EventListener, @button9_event) )
    wxEvtHandler_Connect( button9, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button11
    ''
    Dim As wxButton Ptr button11
    button11 = wxButton_ctor( )
    wxButton_Create( button11, wx_panel, -1, wxString_ctorUTF8("+"), 230, 70, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button11, Cast(EventListener, @button11_event) )
    wxEvtHandler_Connect( button11, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button12
    ''
    Dim As wxButton Ptr button12
    button12 = wxButton_ctor( )
    wxButton_Create( button12, wx_panel, -1, wxString_ctorUTF8("-"), 230, 110, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button12, Cast(EventListener, @button12_event) )
    wxEvtHandler_Connect( button12, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button13
    ''
    Dim As wxButton Ptr button13
    button13 = wxButton_ctor( )
    wxButton_Create( button13, wx_panel, -1, wxString_ctorUTF8("*"), 230, 150, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button13, Cast(EventListener, @button13_event) )
    wxEvtHandler_Connect( button13, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button15
    ''
    Dim As wxButton Ptr button15
    button15 = wxButton_ctor( )
    wxButton_Create( button15, wx_panel, -1, wxString_ctorUTF8("="), 270, 150, 30, 70, 0, 0, 0 )

    wxEvtHandler_Proxy( button15, Cast(EventListener, @button15_event) )
    wxEvtHandler_Connect( button15, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget button14
    ''
    Dim As wxButton Ptr button14
    button14 = wxButton_ctor( )
    wxButton_Create( button14, wx_panel, -1, wxString_ctorUTF8("/"), 230, 190, 30, 30, 0, 0, 0 )

    wxEvtHandler_Proxy( button14, Cast(EventListener, @button14_event) )
    wxEvtHandler_Connect( button14, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )

    ''
    '' create widget textctrl0
    ''

    textctrl0 = wxTextCtrl_ctor( )
    wxTextCtrl_Create( textctrl0, wx_panel, -1, wxString_ctorUTF8("textctrl0"), 90, 30, 200, 20, 0, 0, 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 button0_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "0"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button1_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )
    Dim text As String
    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "1"
            text = wxString_to_fbstring (wxTextCtrl_GetValue (textctrl0))
            Print text
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button2_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "2"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button3_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "3"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button4_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "4"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button5_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "5"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button6_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "6"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button7_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "7"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button8_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "8"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button9_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Eingabe += "9"
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8(Eingabe) )
    End Select

End Sub

Sub button11_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Zahl1 = Val (Eingabe)
            Art = "+"
            Eingabe = ""
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8("+") )
    End Select

End Sub

Sub button12_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Zahl1 = Val (Eingabe)
            Art = "-"
            Eingabe = ""
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8("-") )
    End Select

End Sub

Sub button13_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Zahl1 = Val (Eingabe)
            Art = "*"
            Eingabe = ""
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8("*") )
    End Select

End Sub

Sub button14_event WXCALL ( ByVal event As wxEvent Ptr, ByVal iListener As wxInt )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            Zahl1 = Val (Eingabe)
            Art = "/"
            Eingabe = ""
            wxTextCtrl_SetValue( textctrl0, wxString_ctorUTF8("/") )
    End Select

End Sub

Sub button15_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, wxString_ctorUTF8(Rechnen (Art , Zahl1 , Val (Eingabe))) )
            Eingabe = ""
    End Select

End Sub

Function Rechnen (Art As String , Zahl As Integer , Zahl2 As Integer) As String
    Select Case Art
        Case "+"
            Return Str (Zahl + Zahl2)
        Case "-"
            Return Str (Zahl - Zahl2)
        Case "*"
            Return Str (Zahl * Zahl2)
        Case "/"
            Return Str (Int (Zahl / Zahl2))
    End Select
End Function

''main
wx_app = wxApp_ctor( )
wxApp_RegisterVirtual ( wx_app, @App_OnInit, @App_OnExit )
wxApp_Run(0, 0)