wxFBE, editor for both Windows and Linux

User projects written in or related to FreeBASIC.
Post Reply
Kot
Posts: 336
Joined: Dec 28, 2006 10:34

Re: wxFBE, editor for both Windows and Linux

Post by Kot »

As you said, it works before activating the coding widget. If press "new", drag and drop stops working. I thought it's a bug, not a feature :-(
Good thing is that drag'n'drop works on other parts of the window.
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

I have created a simple form with two textboxes and one button (xml file):

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.5.3.0">
	<object class="wxFrame" name="wx_frame">
		<pos>-1,-1</pos>
		<size>480,150</size>
		<title>Mein Designer Projekt</title>
		<style>wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER</style>
		<object class="wxPanel" name="wx_panel">
			<object class="wxStaticText" name="stattext0">
				<label>Gib einen Text ein:</label>
				<pos>20,20</pos>
				<size>100,20</size>
			</object>
			<object class="wxTextCtrl" name="textctrl0">
				<value>---</value>
				<pos>130,20</pos>
				<size>270,20</size>
			</object>
			<object class="wxButton" name="button0">
				<label>Copy</label>
				<pos>140,60</pos>
				<size>80,20</size>
				<handler events="wxEvent_EVT_COMMAND_BUTTON_CLICKED,"></handler>
			</object>
			<object class="wxTextCtrl" name="textctr1">
				<value>---</value>
				<pos>130,100</pos>
				<size>270,20</size>
			</object>
		</object>
	</object>
</resource>
wxFBE creates the following code:

Code: Select all

#Include Once "fltk-c.bi"

Declare Function button0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer
Sub App_OnInit( )
	
	Dim As Fl_Window Ptr frame = Fl_WindowNew2( 0, 0, 480, 150, "Mein Designer Projekt" )
	
	Dim As Fl_Box Ptr stattext0 = Fl_BoxNew ( 20, 20, 100, 20, "Gib einen Text ein:" )
	
	Dim As Fl_Input Ptr textctrl0 = Fl_InputNew( 130, 20, 270, 20 )
	Fl_Input_SetValue( textctrl0, "---" )
	
	Dim As Fl_ButtonEx Ptr button0 = Fl_ButtonExNew( 140, 60, 80, 20, "Copy" )
	
	Fl_ButtonExSetHandleCB( button0, @button0_event )
	Dim As Fl_Input Ptr textctr1 = Fl_InputNew( 130, 100, 270, 20 )
	Fl_Input_SetValue( textctr1, "---" )
	
	Fl_WindowShow( frame )
End Sub

Function button0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer
	
	Select Case As Const event
		Case FL_EVENT_PUSH
			''add event handler code here
			
	End Select
	
	Return 1
	
End Function


''main
App_OnInit( )
Fl_Run( )
The code can be compiled, but does not run, it is not possible to push the button. It is just a simple test, I want to complete the code in that way that the text is copied from textctrl0 to textctrl1 when the button is clicked.
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Post by MOD »

Add a "Print 123" after "''add event handler code here" and rerun your test. It works just fine here, although the button has no click-animation (not sure why, maybe you can figure it out).
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

FLTK mysticism! But it works, thank you.
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: wxFBE, editor for both Windows and Linux

Post by BasicCoder2 »

I downloaded and pasted fltk-c-1.3.3 to the include library in the FreeBasic folder where fbc.exe and FBIDE reside but cannot find the relevant .dll or .bi file in that folder.
http://www.freebasic-portal.de/tutorial ... n-110.html
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

BasicCoder2, did you download fltk-c-1.3.3.zip from D.J.Peter's project page http://www.freebasic.net/forum/viewtopi ... 14&t=21548? It is dated Jan. 20, 2015 and contains all necessary files (.bi, .dll).
BasicCoder2
Posts: 3906
Joined: Jan 01, 2009 7:03
Location: Australia

Re: wxFBE, editor for both Windows and Linux

Post by BasicCoder2 »

@Lothar Schirm,
Yes downloaded the fltk-c-1.3.3 folder and placed it in C:\FreeBasic\include
I missed the .dll because I was looking down the Type list where it is called an Application extension and I also missed the .bi file because it is called a FreeBASIC source file.
I copied the .dll and .bi into another folder and they are working fine now thank you.
ike
Posts: 387
Joined: Jan 17, 2011 18:59

Re: wxFBE, editor for both Windows and Linux

Post by ike »

It works just fine here, although the button has no click-animation (not sure why, maybe you can figure it out).

RETURN Fl_ButtonExHandleBase(self, event)
and you will get animation

instead

RETURN 1

It is always like that with Ex widgets
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

@MOD, will this be corrected in the wxFBE code generation?
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

More problems with the FLTK emitter! A Window with a listbox:

Code: Select all

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.5.3.0">
	<object class="wxFrame" name="wx_frame">
		<pos>100,100</pos>
		<size>480,320</size>
		<title>Listbox_Form</title>
		<style>wxFRAME_DEFAULT_STYLE Or wxCLOSE_BOX Xor wxMAXIMIZE_BOX Xor wxRESIZE_BORDER</style>
		<object class="wxPanel" name="wx_panel">
			<object class="wxListBox" name="list0">
				<pos>30,30</pos>
				<size>100,200</size>
				<content>
					<item>item0</item>
					<item>item1</item>
					<item>item2</item>
					<item>item3</item>
					<item>item4</item>
					<item>item5</item>
				</content>
				<selection>0</selection>
				<handler events="wxEvent_EVT_COMMAND_LISTBOX_SELECTED,"></handler>
			</object>
		</object>
	</object>
</resource>
Generated code:

Code: Select all

#Include Once "fltk-c.bi"

Declare Function list0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer
Sub App_OnInit( )
	
	Dim As Fl_Window Ptr frame = Fl_WindowNew2( 100, 100, 480, 320, "Listbox_Form" )
	
	Dim As Fl_Hold_Browser Ptr list0 = Fl_Hold_BrowserNew( 30, 30, 100, 200 )
	
	Fl_BrowserAdd( list0, "item0" )
	Fl_BrowserAdd( list0, "item1" )
	Fl_BrowserAdd( list0, "item2" )
	Fl_BrowserAdd( list0, "item3" )
	Fl_BrowserAdd( list0, "item4" )
	Fl_BrowserAdd( list0, "item5" )
	Fl_ButtonExSetHandleCB( list0, @list0_event )
	Fl_WindowShow( frame )
End Sub

Function list0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer
	
	Select Case As Const event
		Case FL_EVENT_PUSH
			''add event handler code here
			
	End Select
	
	Return 1
	
End Function


''main
App_OnInit( )
Fl_Run( )
The compiler returns the following errors:
Listbox_Form.bas(16) warning 3(1): Passing different pointer types, at parameter 1 of FL_BUTTONEXSETHANDLECB()
Listbox_Form.bas(16) error 24: Invalid data types, at parameter 1 of FL_BUTTONEXSETHANDLECB() in 'Fl_ButtonExSetHandleCB( list0, @list0_event )'
Frontier
Posts: 3
Joined: Mar 02, 2015 7:48

Re: wxFBE, editor for both Windows and Linux

Post by Frontier »

Hi MOD, thank you very much for your support in this project.

One question: I am trying to compile wxFBE from source (checked out from SVN r132) under Arch Linux x64 with FBC 1.01 installed (I am the AUR package maintainer for both fbc and fbc-git packages). I plan to create an AUR package for wxFBE as well.

Executing the compile.sh script from within your project check-out directory, return these errors:

Code: Select all

/home/manos/work/wxfbe/inc/mdLanguage.bi(64) error 285: Unsupported statement in -gen gcc mode in 'Dim As Any Ptr param = Va_First()'
/home/manos/work/wxfbe/inc/mdLanguage.bi(67) error 285: Unsupported statement in -gen gcc mode, found 'Va_Arg' in 'temp = Va_Arg(param, ZString Ptr)'
/home/manos/work/wxfbe/inc/mdLanguage.bi(67) warning 4(1): Suspicious pointer assignment
/home/manos/work/wxfbe/inc/mdLanguage.bi(73) error 285: Unsupported statement in -gen gcc mode, found 'Va_Next' in 'param = Va_Next(param, ZString Ptr)'
/home/manos/work/wxfbe/inc/mdLanguage.bi(73) warning 4(1): Suspicious pointer assignment
/home/manos/work/wxfbe/designer/designer.bi(3) error 23: File not found, "md/helper/mdCollectionsHelper.bi" in '#Include Once "md/helper/mdCollectionsHelper.bi"'
I am not that familiar with FreeBasic (yet), could you give me some pointers on fixing this?
MOD
Posts: 555
Joined: Jun 11, 2009 20:15

Re: wxFBE, editor for both Windows and Linux

Post by MOD »

@Lothar:
It would be easier if you would send the correct version for a buggy version so I don't have to play around with fltk.

@Frontier:
mdLanguages uses variadic parameter lists. This is not supported in the x86_64 version of FreeBASIC. For the other problem: You also need mdTypes to compile the current version of wxFBE.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: wxFBE, editor for both Windows and Linux

Post by D.J.Peters »

Why using an extended version of the Fl_Browser widget ?
How ever it must be Fl_Hold_BrowserExNew and Fl_Hold_BrowserExHandleBase is missing in the handle callback.

Joshy

Code: Select all

#Include Once "fltk-c.bi"
Declare Function list0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer

Sub App_OnInit( )
    var frame = Fl_WindowNew2( 100, 100, 480, 320, "Listbox_Form" )
    var list0 = Fl_Hold_BrowserExNew( 30, 30, 100, 200 )
    Fl_BrowserAdd( list0, "item0" )
    Fl_BrowserAdd( list0, "item1" )
    Fl_BrowserAdd( list0, "item2" )
    Fl_BrowserAdd( list0, "item3" )
    Fl_BrowserAdd( list0, "item4" )
    Fl_BrowserAdd( list0, "item5" )
    Fl_Hold_BrowserExSetHandleCB( list0, @list0_event )
    Fl_WindowShow( frame )
End Sub

Function list0_event Cdecl ( ByVal self As Any Ptr, ByVal event As Fl_Event ) As Integer
  Select Case As Const event
    Case FL_EVENT_RELEASE
       ''add event handler code here
       var item = Fl_BrowserGetValue(self)
       if item then  print *Fl_BrowserGetText(self,item)
    End Select
    Return Fl_Hold_BrowserExHandleBase(self,event)
End Function

''main
App_OnInit( )
Fl_Run( )
If you don't extend or replace the functionality of an Fl_Widget don't use a extended version of it use the original Fl_Widget instead.

Code: Select all

#Include Once "fltk-c.bi"

Declare Sub ListCB Cdecl ( ByVal self As Fl_Widget ptr,byval browser as any ptr)

Sub App_OnInit( )
    var frame = Fl_WindowNew2( 100, 100, 480, 320, "Listbox_Form" )
    var list0 = Fl_Hold_BrowserNew( 30, 30, 100, 200 )
    Fl_BrowserAdd( list0, "item0" )
    Fl_BrowserAdd( list0, "item1" )
    Fl_BrowserAdd( list0, "item2" )
    Fl_BrowserAdd( list0, "item3" )
    Fl_BrowserAdd( list0, "item4" )
    Fl_BrowserAdd( list0, "item5" )
    Fl_WidgetSetCallbackArg( list0,@ListCB,list0)
    Fl_WindowShow( frame )
End Sub

Sub ListCB Cdecl ( ByVal self As Fl_Widget ptr,byval browser as any ptr)
  Select Case As Const Fl_EventNumber()
    Case FL_EVENT_RELEASE
       ''add callback code here
       var item = Fl_BrowserGetValue(browser)
       if item then  print *Fl_BrowserGetText(browser,item)
    End Select
End Sub

''main
App_OnInit( )
Fl_Run( )
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: wxFBE, editor for both Windows and Linux

Post by Lothar Schirm »

MOD wrote:@Lothar:
It would be easier if you would send the correct version for a buggy version so I don't have to play around with fltk.
Yes, MOD, you are right, I am sorry. I never used extended versions of widgets and different event constants, so I was not sure about the correct code. I hope Joshy's advice will solve the problem.
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: wxFBE, editor for both Windows and Linux

Post by D.J.Peters »

@Lothar and @MOD
Only as info in the FLTK wrapper all integer/uinteger are long/ulong now.

You don't see any differences on 32-bit platforms but on 64-bit you will get a buch of compile errors.
Of course all proto types of callbacks are changed also.

To fix it download the latest version.
(I changed only the *.bi and *.bas files not the runtime libs self.)

Thanks for your attention. :-)

Joshy
Last edited by D.J.Peters on Mar 26, 2015 4:24, edited 1 time in total.
Post Reply