Buchempfehlung
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
Windows-Programmierung. Das Entwicklerhandbuch zur WIN32-API
"Der" Petzold, das über 1000 Seiten starke Standardwerk zum Win32-API - besonders nützlich u. a. bei der GUI-Programmierung in FreeBASIC! [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

wx-c Beispiel für ytwinky

Uploader:RedakteurMOD
Datum/Zeit:12.07.2011 00:46:27

#Include "inc/wx.bi"

Declare Function App_OnInit APICALL ( ) As wxBool
Declare Function App_OnExit APICALL ( ) As wxInt

Declare Sub button0_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )
Declare Sub button1_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )
Declare Sub button2_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )
Declare Sub button3_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )

Dim Shared As _wxApp Ptr wx_app
Dim Shared As _wxFrame Ptr wx_frame
Dim Shared As _wxPanel Ptr wx_panel

Function App_OnInit APICALL ( ) As wxBool

    wxImage_InitAllHandlers( )

    wx_frame = wxFrame_ctor( )
    wxFrame_Create( wx_frame, WX_NULL, -1, wxString("ChgGateway"), 483, 184, 266, 275, 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 )

    '' Application Icon
    Dim As _wxIcon Ptr appIcon
    Dim As _wxBitmap Ptr iconImage
    appIcon = wxIcon_ctor( )
    iconImage = wxBitmap_ctor( )
    wxBitmap_LoadFile( iconImage, wxString("media/icon.ico"), wxBITMAP_TYPE_ICO )
    wxIcon_CopyFromBitmap( appIcon, iconImage )
    wxFrame_SetIcon( wx_frame, appIcon )

    ''
    '' create widget stattext0
    ''
    Dim As _wxStaticText Ptr stattext0
    stattext0 = wxStaticText_ctor( )
    wxStaticText_Create( stattext0, wx_panel, -1, wxString("ChgGateway"), 10, 10, -1, -1, 0, 0 )

    Dim As _wxFont Ptr font = wxFont_ctorDef( )
    wxFont_SetPointSize( font, 20 )
    wxWindow_SetFont( stattext0, font )

    Dim As _wxColour Ptr col = wxColour_ctor( )
    wxColour_Set( col, 0, 0, 255, 0 )
    wxWindow_SetForegroundColour( stattext0, col )

    ''
    '' create widget stattext1
    ''
    Dim As _wxStaticText Ptr stattext1
    stattext1 = wxStaticText_ctor( )
    wxStaticText_Create( stattext1, wx_panel, -1, wxString("für LAN-Verbindungen"), 10, 55, -1, -1, 0, 0 )


    ''
    '' create widget stattext2
    ''
    Dim As _wxStaticText Ptr stattext2
    stattext2 = wxStaticText_ctor( )
    wxStaticText_Create( stattext2, wx_panel, -1, wxString("Host"), 10, 80, -1, -1, 0, 0 )


    ''
    '' create widget stattext3
    ''
    Dim As _wxStaticText Ptr stattext3
    stattext3 = wxStaticText_ctor( )
    wxStaticText_Create( stattext3, wx_panel, -1, wxString("Gateway"), 10, 110, -1, -1, 0, 0 )


    ''
    '' create widget stattext4
    ''
    Dim As _wxStaticText Ptr stattext4
    stattext4 = wxStaticText_ctor( )
    wxStaticText_Create( stattext4, wx_panel, -1, wxString("DNS-Server"), 10, 140, -1, -1, 0, 0 )


    ''
    '' create widget stattext5
    ''
    Dim As _wxStaticText Ptr stattext5
    stattext5 = wxStaticText_ctor( )
    wxStaticText_Create( stattext5, wx_panel, -1, wxString("WINS-Server"), 10, 170, -1, -1, 0, 0 )

    wxWindow_Enable( stattext5, WX_FALSE )


    ''
    '' create widget stattext6
    ''
    Dim As _wxStaticText Ptr stattext6
    stattext6 = wxStaticText_ctor( )
    wxStaticText_Create( stattext6, wx_panel, -1, wxString("xxx.xxx.xxx.xxx"), 100, 80, -1, -1, 0, 0 )


    ''
    '' create widget stattext7
    ''
    Dim As _wxStaticText Ptr stattext7
    stattext7 = wxStaticText_ctor( )
    wxStaticText_Create( stattext7, wx_panel, -1, wxString("xxx.xxx.xxx.xxx"), 100, 110, -1, -1, 0, 0 )


    ''
    '' create widget staticbox0
    ''
    Dim As _wxStaticBox Ptr staticbox0
    staticbox0 = wxStaticBox_ctor( )
    wxStaticBox_Create( staticbox0, wx_panel, -1, wxString("Status"), 200, 10, 50, 50, 0, 0 )


    ''
    '' create widget image0
    ''
    Dim As _wxBitmap Ptr picimage0, picimage0_1
    Dim As _wxStaticBitmap Ptr image0

    picimage0 = wxBitmap_ctor( )
    picimage0_1 = wxBitmap_ctor( )
    image0 = wxStaticBitmap_ctor( )

    wxBitmap_LoadFile( picimage0, wxString("media/rot.bmp"), wxBITMAP_TYPE_BMP )
    wxBitmap_LoadFile( picimage0_1, wxString("media/gruen.bmp"), wxBITMAP_TYPE_BMP )
    wxStaticBitmap_Create( image0, wx_panel, -1, picimage0, 210, 26, -1, -1, 0, 0 )
    'wxStaticBitmap_SetBitmap( image0, picimage0_1 )


    ''
    '' create widget radio0
    ''
    Dim As _wxArrayString Ptr radio0_str
    radio0_str = wxArrayString_ctor( )
    wxArrayString_Add( radio0_str, wxString( "getrennt" ) )
    wxArrayString_Add( radio0_str, wxString( "verbunden" ) )
    Dim As _wxRadiobox Ptr radio0
    radio0 = wxRadiobox_ctor( )
    wxRadiobox_Create( radio0, wx_panel, -1, wxString("Status setzen"), 10, 200, 160, 40, radio0_str, 0, 0, 0, 0 )
    wxRadiobox_SetSelection( radio0, 0 )


    ''
    '' create widget button0
    ''
    Dim As _wxButton Ptr button0
    button0 = wxButton_ctor( )
    wxButton_Create( button0, wx_panel, -1, wxString("Ping"), 210, 105, 40, 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("Ping"), 210, 135, 40, 24, 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("Ping"), 210, 165, 40, 24, 0, 0, 0 )

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

    wxWindow_Enable( button2, WX_FALSE )

    ''
    '' create widget choice0
    ''
    Dim As _wxArrayString Ptr choice0_str
    choice0_str = wxArrayString_ctor( )
    wxArrayString_Add( choice0_str, wxString( "" ) )
    Dim As _wxChoice Ptr choice0
    choice0 = wxChoice_ctor( )
    wxChoice_Create( choice0, wx_panel, -1, 100, 135, 95, 20, choice0_str, 0, 0, 0 )
    wxChoice_SetColumns( choice0, 0 )


    ''
    '' create widget choice1
    ''
    Dim As _wxArrayString Ptr choice1_str
    choice1_str = wxArrayString_ctor( )
    wxArrayString_Add( choice1_str, wxString( "" ) )
    Dim As _wxChoice Ptr choice1
    choice1 = wxChoice_ctor( )
    wxChoice_Create( choice1, wx_panel, -1, 100, 165, 95, 20, choice1_str, 0, 0, 0 )
    wxChoice_SetColumns( choice1, 0 )

    wxWindow_Enable( choice1, WX_FALSE )

    ''
    '' create widget button3
    ''
    Dim As _wxButton Ptr button3
    button3 = wxButton_ctor( )
    wxButton_Create( button3, wx_panel, -1, wxString("Quit"), 175, 205, 75, 35, 0, 0, 0 )

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

    wxWindow_Show( wx_frame, 1 )

    'Hier einen Thread starten, der den Rest macht

    wxApp_OnInit( wx_app )
    Return 1

End Function

Function App_OnExit APICALL ( ) As wxInt

    Return wxApp_OnExit( wx_app )

End Function

Sub button0_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
    End Select

End Sub

Sub button1_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
    End Select

End Sub

Sub button2_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
    End Select

End Sub

Sub button3_event APICALL ( ByVal event As _wxEvent Ptr, ByVal iListener As Long )

    Select Case wxEvent_GetEventType( event )
        Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
            ''stuff
            End
    End Select

End Sub


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