FLTK 1.3.x C Wrapper (obsolete)
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
month day and year are int's so you need 3 Fl_Int_Input
[16] : [01] : [15]
or
[16] : [01] : [2015]
or you create yor own Fl_Date_Picker widget (use the Fl_WidgetEx as base widget)
Joshy
[16] : [01] : [15]
or
[16] : [01] : [2015]
or you create yor own Fl_Date_Picker widget (use the Fl_WidgetEx as base widget)
Joshy
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
New version published.
removed: DeclareWindow macro
Joshy
here are a testframework !!! all events are optional !!!
removed: DeclareWindow macro
Joshy
here are a testframework !!! all events are optional !!!
Code: Select all
#include once "fltk-c.bi"
type FB_FORM extends Fl_Double_WindowEx
public:
declare destructor
declare constructor(w as long,h as long,caption as zstring ptr=0)
declare constructor(x as long,y as long,w as long,h as long,caption as zstring ptr=0)
declare operator cast as Fl_Widget ptr ' this form as Widget
declare operator cast as Fl_Group ptr ' this form as Group
declare operator cast as Fl_Window ptr ' this form as Window
declare operator cast as Fl_Double_WindowEx ptr ' this form as Double_WindowEx
' user events (optional)
as function (as FB_FORM ptr) as long ShowEvent
as function (as FB_FORM ptr) as long HideEvent
as function (as FB_FORM ptr) as long CloseEvent
as function (as FB_FORM ptr) as long FocusEvent
as function (as FB_FORM ptr) as long UnfocusEvent
as function (as FB_FORM ptr) as long EnterEvent
as function (as FB_FORM ptr) as long LeaveEvent
as function (as FB_FORM ptr) as long DrawEvent
as function (as FB_FORM ptr,x as long,y as long,w as long,h as long) as long ResizeEvent
as function (as FB_FORM ptr,button as long,x as long,y as long) as long ButtonPushEvent
as function (as FB_FORM ptr,button as long,x as long,y as long) as long ButtonReleaseEvent
as function (as FB_FORM ptr,x as long,y as long) as long MouseMoveEvent
as function (as FB_FORM ptr,x as long,y as long) as long MouseDragEvent
as function (as FB_FORM ptr,x as long,y as long,z as long) as long MouseWheelEvent
as function (as FB_FORM ptr,key as long) as long KeyDownEvent
as function (as FB_FORM ptr,key as long) as long KeyUpEvent
private: ' FLTK stuff
declare static sub DestructorCB cdecl(as any ptr)
declare static function DrawCB cdecl(as any ptr) as long
declare static function HandleCB cdecl(as any ptr,event as Fl_Event) as long
declare static function ResizeCB cdecl(as any ptr,x as long,y as long,w as long,h as long) as long
declare sub SetCallbacks
as Fl_Double_WindowEx ptr m_Double_WindowEx
end type
' private form tuff
destructor FB_FORM
if m_Double_WindowEx then Fl_Double_WindowExDelete m_Double_WindowEx
end destructor
constructor FB_FORM(w as long,h as long,caption as zstring ptr)
m_Double_WindowEx = Fl_Double_WindowExNew(w,h,caption) : SetCallbacks
end constructor
constructor FB_FORM(x as long,y as long,w as long,h as long,caption as zstring ptr)
m_Double_WindowEx = Fl_Double_WindowExNew2(x,y,w,h,caption) : SetCallbacks
end constructor
operator FB_FORM.cast as Fl_Widget ptr
operator = m_Double_WindowEx
end operator
operator FB_FORM.cast as Fl_Group ptr
operator = m_Double_WindowEx
end operator
operator FB_FORM.cast as Fl_Window ptr
operator = m_Double_WindowEx
end operator
operator FB_FORM.cast as Fl_Double_WindowEx ptr
operator = m_Double_WindowEx
end operator
sub FB_FORM.SetCallbacks
Fl_Double_WindowExSetDestructorCB(m_Double_WindowEx,@DestructorCB)
Fl_Double_WindowExSetDrawCB (m_Double_WindowEx,@DrawCB)
Fl_Double_WindowExSetHandleCB (m_Double_WindowEx,@HandleCB)
Fl_Double_WindowExSetResizeCB (m_Double_WindowEx,@ResizeCB)
Fl_WidgetSetUserData (m_Double_WindowEx,@This)
end sub
sub FB_FORM.DestructorCB cdecl(win as any ptr)
end sub
function FB_FORM.DrawCB cdecl(win as any ptr) as long
dim as FB_FORM ptr me = Fl_WidgetGetUserData(win)
if me->DrawEvent then return me->DrawEvent(me)
return 0
end function
function FB_FORM.HandleCB cdecl(win as any ptr,event as Fl_Event) as long
dim as FB_FORM ptr me = Fl_WidgetGetUserData(win)
select case as const event
case FL_EVENT_SHOW : if me->ShowEvent then return me->ShowEvent(me)
case FL_EVENT_HIDE : if me->HideEvent then return me->HideEvent(me)
case FL_EVENT_CLOSE : if me->CloseEvent then return me->CloseEvent(me)
case FL_EVENT_FOCUS : if me->FocusEvent then return me->FocusEvent(me)
case FL_EVENT_UNFOCUS : if me->FocusEvent then return me->UnfocusEvent(me)
case FL_EVENT_ENTER : if me->EnterEvent then return me->EnterEvent(me)
case FL_EVENT_LEAVE : if me->LeaveEvent then return me->LeaveEvent(me)
case FL_EVENT_PUSH : if me->ButtonPushEvent then return me->ButtonPushEvent (me,Fl_EventButton(),Fl_EventX(),Fl_EventY())
case FL_EVENT_RELEASE : if me->ButtonReleaseEvent then return me->ButtonReleaseEvent(me,Fl_EventButton(),Fl_EventX(),Fl_EventY())
case FL_EVENT_MOVE : if me->MouseMoveEvent then return me->MouseMoveEvent(me,Fl_EventX(),Fl_EventY())
case FL_EVENT_DRAG : if me->MouseDragEvent then return me->MouseDragEvent(me,Fl_EventX(),Fl_EventY())
case FL_EVENT_MOUSEWHEEL : if me->MouseWheelEvent then return me->MouseWheelEvent(me,Fl_EventX(),Fl_EventY(),Fl_EventDY())
case FL_EVENT_KEYDOWN : if me->KeyDownEvent then return me->KeyDownEvent(me,Fl_EventKey())
case FL_EVENT_KEYUP : if me->KeyUpEvent then return me->KeyUpEvent(me,Fl_EventKey())
end select
' delegate all unhandled events to the base class
dim as Fl_WindowEx ptr ex=win
return Fl_WindowExHandleBase(ex,event)
end function
function FB_FORM.ResizeCB cdecl(win as any ptr,x as long,y as long,w as long,h as long) as long
dim as FB_FORM ptr me = Fl_WidgetGetUserData(win)
if me->ResizeEvent then return me->ResizeEvent(me,x,y,w,h)
return 0
end function
'
' main
'
function ShowEventCB(frm as FB_FORM ptr) as long
print "ShowEventCB"
return 0
end function
function HideEventCB(frm as FB_FORM ptr) as long
print "HideEventCB"
return 0
end function
function FocusEventCB(frm as FB_FORM ptr) as long
print "FocusEventCB"
return 0
end function
function UnfocusEventCB(frm as FB_FORM ptr) as long
print "UnfocusEventCB"
return 0
end function
function EnterEventCB(frm as FB_FORM ptr) as long
print "EnterEventCB"
return 0
end function
function LeaveEventCB(frm as FB_FORM ptr) as long
print "LeaveEventCB"
return 0
end function
function ButtonPushEventCB(frm as FB_FORM ptr,button as long,x as long,y as long) as long
print "ButtonPushEventCB Button(" & button & " at " & x & "," & y & ")"
return 0
end function
function ButtonReleaseEventCB(frm as FB_FORM ptr,button as long,x as long,y as long) as long
print "ButtonReleaseEventCB Button(" & button & " at " & x & "," & y & ")"
return 0
end function
function MouseMoveEventCB(frm as FB_FORM ptr,x as long,y as long) as long
print "MouseMoveEventCB (" & x & "," & y & ")"
return 0
end function
function MouseDragEventCB(frm as FB_FORM ptr,x as long,y as long) as long
print "MouseMoveEventCB (" & x & "," & y & ")"
return 0
end function
function MouseWheelEventCB(frm as FB_FORM ptr,x as long,y as long,z as long) as long
print "MouseWheelEventCB (" & x & "," & y & "," & z & ")"
return 0
end function
function KeyDownEventCB(frm as FB_FORM ptr,key as long) as long
print "KeyDownEventCB Key(" & key & ")"
return 0
end function
function KeyUpEventCB(frm as FB_FORM ptr,key as long) as long
print "KeyUpEventCB Key(" & key & ")"
return 0
end function
function ResizeEventCB(frm as FB_FORM ptr,x as long,y as long,w as long,h as long) as long
print "ResizeEventCB(" & x & "," & y & "," & w & "," & h & ")"
return 0
end function
function DrawEventCB(frm as FB_FORM ptr) as long
print "DrawEventCB"
return 0
end function
var frm1 = new FB_FORM(320,200, "Form 1")
frm1->ShowEvent = @ShowEventCB
frm1->HideEvent = @HideEventCB
frm1->FocusEvent = @FocusEventCB
frm1->UnfocusEvent = @UnfocusEventCB
frm1->EnterEvent = @EnterEventCB
frm1->LeaveEvent = @LeaveEventCB
frm1->ButtonPushEvent = @ButtonPushEventCB
frm1->ButtonReleaseEvent = @ButtonReleaseEventCB
frm1->MouseMoveEvent = @MouseMoveEventCB
frm1->MouseDragEvent = @MouseDragEventCB
frm1->MouseWheelEvent = @MouseWheelEventCB
frm1->KeyDownEvent = @KeyDownEventCB
frm1->KeyUpEvent = @KeyUpEventCB
frm1->ResizeEvent = @ResizeEventCB
frm1->DrawEvent = @DrawEventCB
Fl_WindowShow *frm1
Fl_Run
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
hi ,
please see in fltk-c.bi lines 2228 & 2229 :
' Get/Set the amount of extra space above and below the tooltip's text. (Default is 3.)
declare sub Fl_TooltiSetMarginHeight(byval h as long)
declare function Fl_TooltiGetMarginHeight as long
Toolti...... or Tooltip...... ?
please see in fltk-c.bi lines 2228 & 2229 :
' Get/Set the amount of extra space above and below the tooltip's text. (Default is 3.)
declare sub Fl_TooltiSetMarginHeight(byval h as long)
declare function Fl_TooltiGetMarginHeight as long
Toolti...... or Tooltip...... ?
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
@enform it was a typo in my C++ code and in *.bi file (copy and paste), good find :-)
fixed in fltk-c-1.3.3.zip
Joshy
fixed in fltk-c-1.3.3.zip
Joshy
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
Do you have an example to create a taskbar for linux so i can maximize and minimize window and maybe can close the window too ?
By the way maybe you can add update.zip for the latest changes so i will only download that.
Thanks
Sorry again for my english.
By the way maybe you can add update.zip for the latest changes so i will only download that.
Thanks
Sorry again for my english.
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
@nimdays
If I change one or more lines of the C++ wrapper than all other files are new also.
fltk-c.bi
libfltk-c.1.3.3-32.dll.a
fltk-c.1.3.3-32.dll
libfltk-c.1.3.3-64.dll.a
fltk-c.1.3.3-64.dll
libfltk-c.1.3.3-32.so
libfltk-c.1.3.3-64.so
libfltk-c.1.3.3-32-syslib.so
libfltk-c.1.3.3-64-syslib.so
And if the fltk-c.bi are changed some examples (*.bas) are changed too.
With other words in this case a "update.zip" makes no sense.
Joshy
If I change one or more lines of the C++ wrapper than all other files are new also.
fltk-c.bi
libfltk-c.1.3.3-32.dll.a
fltk-c.1.3.3-32.dll
libfltk-c.1.3.3-64.dll.a
fltk-c.1.3.3-64.dll
libfltk-c.1.3.3-32.so
libfltk-c.1.3.3-64.so
libfltk-c.1.3.3-32-syslib.so
libfltk-c.1.3.3-64-syslib.so
And if the fltk-c.bi are changed some examples (*.bas) are changed too.
With other words in this case a "update.zip" makes no sense.
Joshy
Last edited by D.J.Peters on Jul 12, 2015 22:00, edited 1 time in total.
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
Sorry again ,i didn't know that , i have no problem.D.J.Peters wrote:@nimdays
If I change one or more lines of the C++ wrapper than all other files are new also.
fltk-c.bi
libfltk-c.1.3.3-32.dll.a
fltk-c.1.3.3-32.dll
libfltk-c.1.3.3-64.dll.a
fltk-c.1.3.3-64.dll
libfltk-c.1.3.3-32.so
libfltk-c.1.3.3-64.so
libfltk-c.1.3.3-32-syslib.so
libfltk-c.1.3.3-64-syslib.so
And if the fltk-c.bi are changed some examples (*.bas) are changed too.
With other words in this case a "update.zip" makes no sence.
Joshy
About the taskbar because i read from here
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
@nimdays
The taskbar or info panel is the part of the desktop manager you are using (KDE, GNOME, XFCE, ...)
Joshy
The taskbar or info panel is the part of the desktop manager you are using (KDE, GNOME, XFCE, ...)
Joshy
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
Hello all, I have 2 fltk questions again.
1. Is there a something like a "Fl_Text_DisplayMoveEnd" ? I made my own:
2. Is there something like a "Fl_Text_DisplayClear" ?
Thanks already!
1. Is there a something like a "Fl_Text_DisplayMoveEnd" ? I made my own:
Code: Select all
sub Fl_Text_DisplayMoveEnd(byval td as Fl_Text_Display ptr)
dim as long insPosCur, insPosPre = -1
insPosCur = Fl_Text_DisplayGetInsertPosition(pTextDisplay)
while (insPosCur <> insPosPre)
Fl_Text_DisplayMoveDown(pTextDisplay)
insPosPre = insPosCur
insPosCur = Fl_Text_DisplayGetInsertPosition(pTextDisplay)
wend
end sub
Thanks already!
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
badidea wrote:1. Is there a something like a "Fl_Text_DisplayMoveEnd" ?
badidea wrote:Another question I have is: Can I 'auto'-scroll the pTextDisplay to the last line?
D.J.Peters wrote:@badidea here are ... how scoll to last insert position.Code: Select all
Fl_Text_DisplayShowInsertPosition()
badidea wrote:2. Is there something like a "Fl_Text_DisplayClear" ?
Don't waste my spare time. :lol:fltk-c.bi wrote:' Replaces the entire contents of the text buffer.
Fl_Text_BufferSetText(buf,"")
Joshy
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
1. Yes, but I noticed that when I click in the text display, the insert position is changed. And then text is inserted halfway, which I don't want. So, I am looking for a "Fl_Text_DisplayAppend" or a combination of "move cursor to end" + "Fl_Text_DisplayInsert".Fl_Text_DisplayShowInsertPosition()
2. "Fl_Text_BufferSetText(buf, "")" yes, of course. I am working so slowly on this project that I forget things faster then that I learn.
-
- Posts: 139
- Joined: Feb 04, 2011 20:34
- Location: Ontario, Canada
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
There are two ways to solve this:badidea wrote:1. Yes, but I noticed that when I click in the text display, the insert position is changed. And then text is inserted halfway, which I don't want. So, I am looking for a "Fl_Text_DisplayAppend" or a combination of "move cursor to end" + "Fl_Text_DisplayInsert".Fl_Text_DisplayShowInsertPosition()
1) Manually move the insert position to where you want it.
2) When you click the widget, have the program move the insert point back to where it was before the widget received focus, or always move it to the start or end of the text. If the insert position needs to be somewhere else, use option 1.
I always have the code place the insert point to the start of the text, and then manually move it to where I need it.
Rod
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
Ok, my Text_Display issues are solved for now. But, another question:
How do I launch a 'child' window? E.g. a window that is launched after pressing a button on the main window. And when open, the main window is not accessible (cannot be closed or any element changed).
This code does not do what I want:
How do I launch a 'child' window? E.g. a window that is launched after pressing a button on the main window. And when open, the main window is not accessible (cannot be closed or any element changed).
This code does not do what I want:
Code: Select all
#include once "fltk-c.bi"
dim shared as Fl_Window ptr pWin, pWinChild
dim shared as Fl_Button ptr pButton
sub buttonAction cdecl (byval self as Fl_Widget ptr)
pWinChild = Fl_WindowNew(400, 300, "Child")
Fl_WidgetDeactivate(pWin)
Fl_WindowShow(pWinChild)
end sub
pWin = Fl_WindowNew(600, 400, "Main window")
pButton = Fl_ButtonNew(20, 20, 200, 25, "Open child window")
Fl_WidgetSetCallback0(pButton, @buttonAction)
Fl_WindowShow(pWin)
Fl_Run
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
@badidea Ask your self !
1) How should FLTK know where are the X,Y position of your new child widget ?
2) How should FLTK know who are the parent of your new child ?1) Fl_WindowNew2() used X,Y,w,h
2) Fl_WindowBegin ' open list of child's from parent
Fl_WindowEnd ' close list of child's
By the way a child window doesn't have a titlebar or resizeable boarder.
Only in a multi document environment (MDI) exist child windows in it's parent container.
In real a child window is a Fl_Group and yes the parent window is a Fl_Group also.
That means you don't need a child window or child group
1) open the parent group
2) add new child widgets
3) close the parent group
It's to warm here I go in the garden and test my DIY shower. :-)
Joshy
1) How should FLTK know where are the X,Y position of your new child widget ?
2) How should FLTK know who are the parent of your new child ?
Code: Select all
#include once "fltk-c.bi"
dim shared as Fl_Window ptr pWin, pWinChild
dim shared as Fl_Button ptr pButton
sub buttonAction cdecl (byval self as Fl_Widget ptr)
if pWinChild then return
Fl_WindowBegin pWin
pWinChild = Fl_WindowNew2(50,50,200,100)
Fl_WidgetSetColor pWinChild,FL_WHITE
Fl_WindowEnd pWin
Fl_WindowShow pWinChild
end sub
pWin = Fl_WindowNew(600, 400, "Main window")
pButton = Fl_ButtonNew(20, 20, 200, 25, "Open child window")
Fl_WidgetSetCallback0(pButton, @buttonAction)
Fl_WindowShow(pWin)
Fl_Run
2) Fl_WindowBegin ' open list of child's from parent
Fl_WindowEnd ' close list of child's
By the way a child window doesn't have a titlebar or resizeable boarder.
Only in a multi document environment (MDI) exist child windows in it's parent container.
In real a child window is a Fl_Group and yes the parent window is a Fl_Group also.
That means you don't need a child window or child group
1) open the parent group
2) add new child widgets
3) close the parent group
Code: Select all
#include once "fltk-c.bi"
sub ButtonCB cdecl (self as Fl_Widget ptr)
var parent = Fl_WidgetWindow(self)
var nChilds = Fl_GroupChildren(parent)
var label = "child " & nChilds
Fl_WindowBegin parent
Fl_WidgetCopyLabel Fl_BoxNew( rnd*(Fl_WidgetGetW(parent)-64), _
50+rnd*(Fl_WidgetGetH(parent)-74), 64,24),label
Fl_WindowEnd parent
end sub
var win = Fl_WindowNew(600, 400, "Main window")
Fl_WidgetSetCallback0 Fl_ButtonNew(20, 20, 200, 25, "add new widget[s]"), @ButtonCB
Fl_WindowShow win
Fl_Run
Joshy
Last edited by D.J.Peters on Jul 20, 2015 0:47, edited 2 times in total.
-
- Posts: 8631
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK 1.3.3 C Wrapper Windows/Linux 32/64-bit.
@badidea a nother point.
If you deactivate any parent all childs are deactivate also.
(I think this are the right behavior)
Of course you can deactivate individual child widgets or child groups.
Joshy
If you deactivate any parent all childs are deactivate also.
(I think this are the right behavior)
Of course you can deactivate individual child widgets or child groups.
Joshy