wxWidgets 2.8.12 FreeBASIC C wrapper
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
wxWidgets 2.8.12 FreeBASIC C wrapper
wxWidgets c wrapper 2.8.12 (improved wxEventHandler, added wxGLCanvas, wxTimer and wxSound)
Download: wx-c_2.8.12.zip
Joshy
Download: wx-c_2.8.12.zip
Joshy
Last edited by D.J.Peters on May 10, 2024 9:14, edited 8 times in total.
Re: wxWidgets 2.8.12 FreeBASIC C wrapper (preview)
Poor you!D.J.Peters wrote:but after >8000 lines of code in 150 files
i must go sleeping now ;-)
I know what you're talking about. (GTK headers have > 30,000 LOC and > 400 files and meanwhile I did versions 2.18.6, 2.22.0 and 3.0.)
As a documentation you can use the helpfile included with Visual WX-C Designer.
Another simple example:
This was created with the designer to see what I've to change. It will be some work but it seems to be easier than I thought.
It would be an idea to include something like to get rid of the underscores. The explizit useage of '..._ctor' isn't a problem because the old wrapper sometimes used it with and sometimes without thhis postfix.
wxSize() seems to be not needed anymore, I've to change all functions in the designer.
WX_TRUE, _FALSE and _NULL are defined now, so I drop the definitions in code.
I also saw your WX_OOP-definition. I think it would be better to seperate this 'addon' into one single new file, so you can include either "wx-c.bi" or "wx-c-oop.bi" (or something similar).
But for now: great work!
Another simple example:
Code: Select all
#Include "inc/wx.bi"
'#Define wxCLOSE_BOX &h1000
#Define FALSE 0
#Define TRUE (NOT FALSE)
Declare Sub App_OnInit( )
Declare Sub App_OnExit( )
Declare Sub button0_event( 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
Dim Shared As _wxTextCtrl Ptr textctrl0
Sub App_OnInit( )
wx_frame = wxFrame_ctor( )
wxFrame_Create( wx_frame, 0, -1, wxString("My WX-C Project"), 483, 184, 390, 390, /'wxDEFAULT_FRAME_STYLE'/wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER, NULL )
wx_panel = wxPanel_ctor2( wx_frame, -1, -1, -1 , -1, -1 , 0, 0 )
''
'' create widget button0
''
Dim As _wxButton Ptr button0
button0 = wxButton_ctor( )
wxButton_Create( button0, wx_panel, -1, wxString("button0"), 70, 270, 250, 60 , 0, 0, 0 )
wxEvtHandler_proxy( button0, Cast(EventListener, @button0_event) )
wxEvtHandler_Connect( button0, wxEvent_EVT_COMMAND_BUTTON_CLICKED( ), -1, -1, 0 )
''
'' create widget staticline0
''
Dim As _wxStaticLine Ptr staticline0
staticline0 = wxStaticLine_ctor( )
wxStaticLine_Create( staticline0, wx_panel, -1, 30, 250 ,330, 10 , 0, 0 )
''
'' create widget checkbox0
''
Dim As _wxCheckBox Ptr checkbox0
checkbox0 = wxCheckBox_ctor( )
wxCheckBox_Create( checkbox0, wx_panel, -1, wxString("checkbox0"), 30, 20 , -1, -1 , 0, 0, 0 )
wxCheckBox_SetValue( checkbox0, 0 )
''
'' create widget checkbox1
''
Dim As _wxCheckBox Ptr checkbox1
checkbox1 = wxCheckBox_ctor( )
wxCheckBox_Create( checkbox1, wx_panel, -1, wxString("checkbox1"), 30, 50 ,-1, -1 , 0, 0, 0 )
wxCheckBox_SetValue( checkbox1, 0 )
''
'' create widget checkbox2
''
Dim As _wxCheckBox Ptr checkbox2
checkbox2 = wxCheckBox_ctor( )
wxCheckBox_Create( checkbox2, wx_panel, -1, wxString("checkbox2"), 30, 80 , -1, -1 , 0, 0, 0 )
wxCheckBox_SetValue( checkbox2, 0 )
''
'' create widget staticbox0
''
Dim As _wxStaticBox Ptr staticbox0
staticbox0 = wxStaticBox_ctor( )
wxStaticBox_Create( staticbox0, wx_panel, -1, wxString("staticbox0"), 110, 10 , 270, 90 , 0, 0 )
''
'' create widget textctrl0
''
'Dim As _wxTextCtrl Ptr textctrl0
textctrl0 = wxTextCtrl_ctor( )
wxTextCtrl_Create( textctrl0, wx_panel, -1, wxString("textctrl0"),40, 220 , 310, 21 , 0, 0, 0 )
wxWindow_Show( wx_frame, 1 )
wxApp_OnInit( wx_app )
End Sub
Sub App_OnExit( )
wxApp_OnExit( wx_app )
End Sub
Sub button0_event( ByVal event As _wxEvent Ptr, ByVal iListener As Long )
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
wxTextCtrl_SetValue(textctrl0, wxString("Blabla"))
End Select
End Sub
''main
wx_app = wxApp_ctor( )
wxApp_RegisterVirtual ( wx_app, Cast( Virtual_OnInit, @App_OnInit ), Cast( Virtual_OnExit, @App_OnExit ) )
wxApp_Run(0,0)
End
It would be an idea to include something like
Code: Select all
#define wxApp _wxApp
wxSize() seems to be not needed anymore, I've to change all functions in the designer.
WX_TRUE, _FALSE and _NULL are defined now, so I drop the definitions in code.
I also saw your WX_OOP-definition. I think it would be better to seperate this 'addon' into one single new file, so you can include either "wx-c.bi" or "wx-c-oop.bi" (or something similar).
But for now: great work!
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
I don't know what are changed, removed or are new.
So far i know
wx-c.dll wxWidgets 2.4 is ~1.5 MB
wx-c.dll wxWidgets 2.6 is ~3.5 MB
wx-c.dll wxWidgets 2.8 is ~6.0 MB
something must be new
Joshy
So far i know
wx-c.dll wxWidgets 2.4 is ~1.5 MB
wx-c.dll wxWidgets 2.6 is ~3.5 MB
wx-c.dll wxWidgets 2.8 is ~6.0 MB
something must be new
Joshy
Last edited by D.J.Peters on Jul 06, 2011 22:32, edited 1 time in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Hello MOD
thank you for your helpfull example
but i saw some mistakes in your code.
First of all renember wxWidgets is for different platforms
so you must use the defined APICALL
of course on Linux it is CDECL on Windows STDCALL
Please don't cast sub or function pointers (never)
!!! OnInit and OnExit ar functions and not subs !!!
Joshy
thank you for your helpfull example
but i saw some mistakes in your code.
First of all renember wxWidgets is for different platforms
so you must use the defined APICALL
of course on Linux it is CDECL on Windows STDCALL
Please don't cast sub or function pointers (never)
!!! OnInit and OnExit ar functions and not subs !!!
Joshy
Code: Select all
#Include "inc/wx.bi"
Declare Sub button0_event APICALL(event As _wxEvent Ptr,iListener As wxInt )
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
function App_OnInit APICALL( ) as wxBool
wx_frame = wxFrame_ctor( )
wxFrame_Create(wx_frame, WX_NULL, -1, wxString("My WX-C Project"), _
-1, -1, 390, 390, wxFRAME_DEFAULT_STYLE _
Or wxCLOSE_BOX _
Xor wxMAXIMIZE_BOX _
Xor wxRESIZE_BORDER, 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("button0"), _
70, 270, 250, 60 , 0, 0, WX_NULL )
wxEvtHandler_proxy(button0, @button0_event)
wxEvtHandler_Connect(button0, _
wxEvent_EVT_COMMAND_BUTTON_CLICKED(), _
-1, -1, 0)
''
'' create widget staticline0
''
Dim As _wxStaticLine Ptr staticline0
staticline0 = wxStaticLine_ctor( )
wxStaticLine_Create(staticline0, wx_panel, -1, _
30, 250 ,330, 10 , 0, WX_NULL)
''
'' create widget staticbox0
''
Dim As _wxStaticBox Ptr staticbox0
staticbox0 = wxStaticBox_ctor( )
wxStaticBox_Create( staticbox0, wx_panel, -1, wxString("staticbox0"), _
10, 10 , 120, 90 , 0, WX_NULL)
''
'' create widget checkbox0
''
Dim As _wxCheckBox Ptr checkbox0
checkbox0 = wxCheckBox_ctor( )
wxCheckBox_Create(checkbox0, staticbox0, -1, wxString("checkbox0"), _
10, 20 , -1, -1 , 0, 0, WX_NULL)
wxCheckBox_SetValue( checkbox0, 0 )
''
'' create widget checkbox1
''
Dim As _wxCheckBox Ptr checkbox1
checkbox1 = wxCheckBox_ctor( )
wxCheckBox_Create( checkbox1, staticbox0, -1, wxString("checkbox1"), _
10, 40 ,-1, -1 , 0, 0, WX_NULL)
wxCheckBox_SetValue( checkbox1, 0 )
''
'' create widget checkbox2
''
Dim As _wxCheckBox Ptr checkbox2
checkbox2 = wxCheckBox_ctor( )
wxCheckBox_Create( checkbox2, staticbox0, -1, wxString("checkbox2"), _
10, 60 , -1, -1 , 0, 0, WX_NULL)
wxCheckBox_SetValue( checkbox2, 0 )
''
'' create widget textctrl0
''
'Dim As _wxTextCtrl Ptr textctrl0
textctrl0 = wxTextCtrl_ctor( )
wxTextCtrl_Create( textctrl0, wx_panel, -1, wxString("textctrl0"), _
40, 220 , 310, 21 , 0, 0, WX_NULL)
wxWindow_Show( wx_frame, 1 )
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(event As _wxEvent Ptr, iListener As wxInt )
Select Case wxEvent_GetEventType( event )
Case wxEvent_EVT_COMMAND_BUTTON_CLICKED
wxTextCtrl_SetValue(textctrl0, wxString("Blabla"))
End Select
End Sub
''main
wx_app = wxApp_ctor()
wxApp_RegisterVirtual wx_app, @App_OnInit, @App_OnExit
wxApp_Run()
Last edited by D.J.Peters on Jul 07, 2011 7:34, edited 1 time in total.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
I began with the object oriented wxWidgets framework
Joshy
Joshy
Last edited by D.J.Peters on Jul 08, 2011 3:31, edited 1 time in total.
I like this
I like this - good work!!!
ike
ike
Great Job Joshy !
but isn't 2.8.12 somewhat outdated ... *hust* *duckundweg*
at my first test i found in listbox a difference
all other widgets i found (so far) are using now... x ,y, w, h, not wxPoint
On ListCtrl i couldn't create columns....
ListItems will insert one after another without using Cols..
Maybe this is the standard behavior... I'will check on wxwidgets
Grüße
RWK
but isn't 2.8.12 somewhat outdated ... *hust* *duckundweg*
at my first test i found in listbox a difference
Code: Select all
wxListBox_Create)(self as _wxListBox ptr, parent as _wxWindow ptr, id as wxWindowID, pt as _wxPoint ptr, size as _wxSize ptr, items as _wxArrayString ptr, style as wxUInt, validator as _wxValidator ptr, nameArg as _wxString ptr) as wxBool
On ListCtrl i couldn't create columns....
ListItems will insert one after another without using Cols..
Code: Select all
dim as _wxListItem ptr Row = wxListItem_ctor()
dim as _wxListCtrl ptr listNr = wxListCtrl_ctor()
wxListCtrl_Create( listNr, frame, -1, 10, 140 , 550, 400 , 0, WX_NULL, WX_NULL )
for x as integer = 0 to 4
wxListItem_SetText(row, wxstring("Col " & str(x)))
wxListitem_SetImage(row, -1)
wxListCtrl_InsertColumn(listNr, x, row)
'wxListCtrl_InsertTextColumn(listNr, x, wxstring("Col " & str(x)), 100,100)
next x
for x as integer = 0 to 10
wxListItem_SetText(row,wxstring("row " & str(x)))
wxListCtrl_InsertItem(listNr,row)
next x
Grüße
RWK
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
2.9.2 is a development release (not stable ATM)Drago wrote:but isn't 2.8.12 somewhat outdated ...
yes but you can wrap around this with your own version.Drago wrote:at my first test i found in listbox a difference
something like this:
Code: Select all
function wxListBox_Create2(self as _wxListBox ptr, _
parent as _wxWindow ptr=WX_NULL, _
id as wxWindowID=-1, _
x as wxInt=-1, _
y as wxInt=-1, _
w as wxInt=-1, _
h as wxInt=-1, _
items as _wxArrayString ptr, _
style as wxUInt=0, _
validator as _wxValidator ptr=WX_NULL, _
nameArg as _wxString ptr=WX_NULL) as wxBool
dim as _wxPoint ptr pPoint = wxPoint_ctor(x,y)
dim as _wxSize ptr pSize = wxSize_ctor(w,h)
return wxListBox_Create(self,parent,id,pPoint,pSize,items,style,validator,nameArg)
end function
if i create the ListCtrl object i will try itDrago wrote:aOn ListCtrl i couldn't create columns...
Joshy
Last edited by D.J.Peters on Jul 07, 2011 12:46, edited 1 time in total.
The old versions of wx-c are shrinked with UPX, maybe this is the reason for the new large file.
Yes, I saw the changes with APICALL and function instead of sub. The example was a first shot with minimal changes from the designer output which compiled just fine.
The objectoriented version looks nice, try to implement it in a way like wx.Net does so we can use their documentation. The latest documentation of wxWidgets (which is pretty much the same like wx-c) can be downloaded here: http://sourceforge.net/projects/wxwindo ... p/download
Version 2.8.12 is the latest as he said. 2.9 is not stable.
The lack of wxPoint and wxSize in the parameters seems to be something new to the wrapper. wxWidgets uses them and also the old version of wx-c.
You should be able to add columns with wxListCtrl_InsertColumn(). See documentation.
Yes, I saw the changes with APICALL and function instead of sub. The example was a first shot with minimal changes from the designer output which compiled just fine.
The objectoriented version looks nice, try to implement it in a way like wx.Net does so we can use their documentation. The latest documentation of wxWidgets (which is pretty much the same like wx-c) can be downloaded here: http://sourceforge.net/projects/wxwindo ... p/download
Version 2.8.12 is the latest as he said. 2.9 is not stable.
The lack of wxPoint and wxSize in the parameters seems to be something new to the wrapper. wxWidgets uses them and also the old version of wx-c.
You should be able to add columns with wxListCtrl_InsertColumn(). See documentation.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
hello Drago
i changed the wrapper source code for you (...x,y,w,h...) download the last version.
i removed the word preview from folder you can delete the old folder.
hello MOD
thank you for the help files good for offline viewing.
take a short look of your example i posted you can see i placed the checkboxes on the staticbox
and it works on windows but on Linux i get a crash message from the GTK lib.
If the checkboxes are on the panel it works on Linux too.
Strange behavior :-(
Joshy
i changed the wrapper source code for you (...x,y,w,h...) download the last version.
i removed the word preview from folder you can delete the old folder.
hello MOD
thank you for the help files good for offline viewing.
take a short look of your example i posted you can see i placed the checkboxes on the staticbox
and it works on windows but on Linux i get a crash message from the GTK lib.
If the checkboxes are on the panel it works on Linux too.
Strange behavior :-(
Joshy
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
I found it.MOD wrote:Edit: see documentation (the first sentences)
wxDoc wrote:Please note that a static box should not be used as the parent for the controls it contains, instead they should be siblings of each other. Although using a static box as a parent might work in some versions of wxWidgets, it results in a crash under, for example, wxGTK.