GUI library for Windows \ Linux (window9)

Headers, Bindings, Libraries for use with FreeBASIC, Please include example of use to help ensure they are tested and usable.
Post Reply
RNBW
Posts: 267
Joined: Apr 11, 2015 11:06
Location: UK

Re: FBGUI library for Windows 2

Post by RNBW »

VANYA

Thank you for your prompt response. It's much clearer to me now.
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

Update Library.
Applies only to the version for the Linux platform. In short, added printer functionality and improved window resizing on GTK3.

Added functions:
Startprinter
Stopprinter
Framepage
Printtext
Printimage
Colorprinter
Fontprinter
Getrealsize
Getfullsize
Getlenstring
Getcountdoc
Pagestart
Pageend
Textprinter
Hwndprinter
GetDesktopWindow

Changes:
Main window on GTK3 now behave the same as on GTK2 when resized (thanks to Xusinboy Bekchanov for the tip).
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for Windows 2

Post by enform »

Hi Vanya ,
Thank you for the new version , its' a pleasure to work with it !
thanks to RNBW for the work++ of translation .

Simply reading the gtk3.bi file is FFFFFFFFF !!! ... courageous coders ... you are , guys .

I have adapted to Linux Xubuntu at least one code now ! And I have just uploaded it to the forum : CompileAndRunLin4 ;
If you can report how it works for you , thanks .

In the execution of different codes , i have the impression that gtk send more warnings or 'critical' messages ( and crashes ! ) than Windows .

In the chm , i read : ClearClipBoard and FreeGpBitmap but they are missing .
If i try SetClipBoardText("") gtk crashes but with a space SetClipBoardText("") it's ok .
Can you verify if the height of a window OpenWindow(......200) gives the same size in Window and Linux , for me the diff is 15 pixels .
I have had a problem with GetTopIndexListBox with a lines of text long enough to trigger the auto Horizontal scroll bar , the text moves
horizontally when the bin is executed . I found a solution on internet ! for that , the 'column' parameter should be NULL .

greetings !

the code below works for me :

Code: Select all

#Include "window9.bi" 

OpenWindow("",10,10,400,150) 

Function GetTopIndexListBoxA (iGadget as long) as Long
	
	dim as GtkWidget ptr listbox = GadgetId(iGadget)
	
	dim as GtkTreePath ptr path
	
	dim as any ptr column 
	
	dim as Gint cell_x , cell_y
	
	gtk_tree_view_get_path_at_pos (cast(any ptr ,listbox), 1,1, @path, @column, @cell_x,@cell_y)

	'gtk_tree_view_scroll_to_cell(cast(any ptr ,listbox) , path , Column , FALSE,0,0) ' align rows on the upper edge 
	gtk_tree_view_scroll_to_cell(cast(any ptr ,listbox) , path , NULL , FALSE,0,0) ' align rows on the upper edge 

	function = *gtk_tree_path_get_indices( path )	
	
	gtk_tree_path_free(path)

End Function

ListBoxGadget(1,10,10,100,80)
For a As Integer=1000 To 1400
   AddListBoxItem(1,Str(a) + "00000000000000000000000000000000000000000000000000000000000000")
Next 

Do
   Var event=WaitEvent
   Select Case event
      Case EventClose
         End
      Case EventGadget
         If EventNumber=1 Then
            ? GetTopIndexListBoxA(1)
         endif
   End Select
Loop 
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

Hi enform!
FreeGpBitmap
This function has been renamed to Free_ImageA: viewtopic.php?p=283352#p283352
Can you verify if the height of a window OpenWindow(......200) gives the same size in Window and Linux , for me the diff is 15 pixels .
On Windows 10, the window size may not match: viewtopic.php?p=278750#p278750
ClearClipBoard ... GetTopIndexListBox ... SetClipBoardText ...
Fixed. The library has been updated.
I have adapted to Linux Xubuntu at least one code now ! And I have just uploaded it to the forum : CompileAndRunLin4 ;
If you can report how it works for you , thanks .
The dimensions of buttongadget, textgadget and some others should preferably be at least 25 (or better than 30) in height, otherwise there will be such an effect:
Image
jmgbsas
Posts: 35
Joined: Dec 26, 2020 16:03

Re: FBGUI library for windows 2

Post by jmgbsas »

petan wrote:Another.
Matrix values are printed Ok in listbox, which is scrollable Ok.

Now I need scan fo keypress F1, ( which opens second window with menu - sort matrix by XY column; by this choice is matrix completely resorted and again called window with listbox and printed rearranged all values of matrix).
Do
ev=WaitEvent() 'wait key button press
'Loop Until ev=EventClose
Loop Until ev=EventKeyDown
'Loop Until ev=EventClose Or ev=EventKey
'Loop Until (ev=EventClose Or ev=EventKeyDown)
'Loop Until (ev=EventClose Or ev=EventKeyDown Or ev=EventGadget)
'Loop Until (ev=EventClose Or ev=EventKeyDown Or ev=EventLBDOWN Or ev=EventRBDOWN)
Assuming here is needed some loop for key scan.Window with listbox will be keeped alive.

Code: Select all

Do 
ev=WaitEvent()     'wait key press
' ?? recognize F1 keypress 

Loop

REM 'Loop Until (ev=EventClose Or ev=EventKeyDown) does not work for me
REM 'Loop Until  ev=EventGadget  this close window
Pete
------------------------
I had the same issue and read all this stuff from here...I found my solution....
I am in windows 7, we need to test it in linus window9.bi say run in linux too I dont know,
I was searching in winapi and winwos9i help I could do it, is running ok for example I have a ListboxGadget
I have several modules...i am using common shared..
Common Shared As hwnd hwndC, hwndListBox

hwndC = OpenWindow("RollMusic Control ver 0.4.3.2",10,10,ancho*3/4,alto*4/5,,WS_EX_ACCEPTFILES )
hwndListBox= ListBoxGadget(3,10,10,240,650,LBS_EXTENDEDSEL Or LBS_DISABLENOSCROLL Or WS_VSCROLL Or WS_HSCROLL Or LBS_WANTKEYBOARDINPUT )

The important thing is to add th flag LBS_WANTKEYBOARDINPUT in my case that is in the help
and then the help talk about WM_VKEYTOITEM , with the flag LBS_WANTKEYBOARDINPUT you can receive WM_VKEYTOITEM , that flag only say "you receive a keybord event" and then I select
If EventKEY = VK_DELETE Then ....and put my code for that event,.,,,
but all this occurs inside a gadget event, you have 4 levels to detect

eventgadget ---> eventnumber()--->WM_VKEYTOITEM----> EventKEY
GADGET --> NUMBER OF GADGET --> WM_VKKEYTOITEM ----> EventKEy as VK_DELETE or any other....

Structure of the code:.....

Common Shared As hwnd hwndC, hwndListBox
COMMON Shared As Long eventC

hwndC = OpenWindow("RollMusic Control ver 0.4.3.2",10,10,ancho*3/4,alto*4/5,,WS_EX_ACCEPTFILES )
hwndListBox= ListBoxGadget(3,10,10,240,650,LBS_EXTENDEDSEL Or LBS_DISABLENOSCROLL Or WS_VSCROLL Or WS_HSCROLL Or LBS_WANTKEYBOARDINPUT )

Do
eventC=WaitEvent()
Select Case EVENTC
Case EventMenu
Select case EventNumber
Case 1010
Case 1020
Case 1040
Case 1050
Case 1060
End Select
Case eventgadget
If eventnumber()=3 Then ''' 3 from ListBoxGadget(3,<--3 is the number of the listbox gadget
.....
item=GetListBoxText(3,GetItemListBox(3)) '''' 3 from ListBoxGadget(3,<--
.....
If WM_VKEYTOITEM Then ' enabled with the flag LBS_WANTKEYBOARDINPUT
Print #1,"---------->>> PRESS KEYBOARDa "
If EventKEY = VK_DELETE Then
DeleteListBoxItem(3,GetItemListBox(3)) '''' 3 from ListBoxGadget(3, <---
endif
else
' here for default take the click mouse event....
endif
end if
Case EventClose
Close:End 0
End Select
Loop
----
And All run ok I can detect keyboards in a gadget easily with windows9.bi
WM_VKEYTOITEM and VK_DELETE and other are all in HELP of windows9.bi and in windows API searching
with google..
Greetings
jose
miilvyxg
Posts: 193
Joined: Dec 07, 2021 6:51

Re: FBGUI library for Windows 2

Post by miilvyxg »

Could you build the dynamic library? I only see static library.
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

miilvyxg wrote:Could you build the dynamic library? I only see static library.
I dabbled somehow and created a dynamic library for linux 64-bit. For Windows did not try to create.

If you want, you can try a dynamic library with an example and header files for the C ++ language. The version of window9 in the archive is not the newest, it was just for testing:

test window9+language C++
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

Re: FBGUI library for Windows 2

Post by j8w344c6 »

VANYA wrote:
miilvyxg wrote:Could you build the dynamic library? I only see static library.
I dabbled somehow and created a dynamic library for linux 64-bit. For Windows did not try to create.

If you want, you can try a dynamic library with an example and header files for the C ++ language. The version of window9 in the archive is not the newest, it was just for testing:

test window9+language C++
Your library could be used from C++? Does the C++ binding complete or only as a proof of concept?
If it's a complete binding then with swig I could create binding for many languages.
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

j8w344c6 wrote:
VANYA wrote:
miilvyxg wrote:Could you build the dynamic library? I only see static library.
I dabbled somehow and created a dynamic library for linux 64-bit. For Windows did not try to create.

If you want, you can try a dynamic library with an example and header files for the C ++ language. The version of window9 in the archive is not the newest, it was just for testing:

test window9+language C++
Your library could be used from C++? Does the C++ binding complete or only as a proof of concept?
If it's a complete binding then with swig I could create binding for many languages.
I haven't done full testing, but in principle almost all functions should work in C ++. Again I write: the library being built is not the newest version of the library. In addition, it will not work so easily to translate into other programming languages, since the library actively uses the freebasic type "STRING". For C ++, I wrote a similar analogue (file string.h).
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

Re: FBGUI library for Windows 2

Post by j8w344c6 »

VANYA wrote:
j8w344c6 wrote:
VANYA wrote:
I dabbled somehow and created a dynamic library for linux 64-bit. For Windows did not try to create.

If you want, you can try a dynamic library with an example and header files for the C ++ language. The version of window9 in the archive is not the newest, it was just for testing:

test window9+language C++
Your library could be used from C++? Does the C++ binding complete or only as a proof of concept?
If it's a complete binding then with swig I could create binding for many languages.
I haven't done full testing, but in principle almost all functions should work in C ++. Again I write: the library being built is not the newest version of the library. In addition, it will not work so easily to translate into other programming languages, since the library actively uses the freebasic type "STRING". For C ++, I wrote a similar analogue (file string.h).
It's already enough to generate binding with swig my friend. I will try.
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

Re: FBGUI library for Windows 2

Post by j8w344c6 »

Generating binding for this library using swig is pretty straight forward. But I have a few questions to ask you.

What does these operators mean?

operator[]
operator==
operator!=
operator=
operator+=
operator+

I have real trouble understanding what the last three operators do. Thank you.
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

j8w344c6 wrote:Generating binding for this library using swig is pretty straight forward. But I have a few questions to ask you.

What does these operators mean?

operator[]
operator==
operator!=
operator=
operator+=
operator+

I have real trouble understanding what the last three operators do. Thank you.
this C++ operators overloading.
j8w344c6
Posts: 184
Joined: Oct 25, 2021 10:18

Re: FBGUI library for Windows 2

Post by j8w344c6 »

VANYA wrote:
j8w344c6 wrote:Generating binding for this library using swig is pretty straight forward. But I have a few questions to ask you.

What does these operators mean?

operator[]
operator==
operator!=
operator=
operator+=
operator+

I have real trouble understanding what the last three operators do. Thank you.
this C++ operators overloading.
I know my friend. But what do they do?
operator= is assignment of the current string with the string in argument?
operator+= and operator+, which is append, which is concat?
It's very difficult for someone doesn't know C/C++ to read and understand the code. There is no comments.
VANYA
Posts: 1837
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for Windows 2

Post by VANYA »

j8w344c6 wrote: I know my friend. But what do they do?
operator= is assignment of the current string with the string in argument?
operator+= and operator+, which is append, which is concat?
It's very difficult for someone doesn't know C/C++ to read and understand the code. There is no comments.
There are C++ reference books for such questions. This forum thread is not for learning the basics of C++.
Munair
Posts: 1286
Joined: Oct 19, 2017 15:00
Location: Netherlands
Contact:

Re: FBGUI library for Windows 2

Post by Munair »

Wikipedia:
Operator overloading is syntactic sugar, and is used because it allows programming using notation nearer to the target domain[1] and allows user-defined types a similar level of syntactic support as types built into a language. It is common, for example, in scientific computing, where it allows computing representations of mathematical objects to be manipulated with the same syntax as on paper.
Personally, I never really understood the need of operator overloading. FB supports it as many other languages do, but I never used it once in over 30 years of programming.
Post Reply