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
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Window9 - FBGUI library for windows 2

Post by Makoto WATANABE »

I tested samples of "SetComboBoxItemText", "SetListBoxItemText" and "SetItemListBox" of window9 with Freebasic1.00.1.
A following error was displayed .

C:\Tool\FreeBASIC\inc\win\windef.bi(81) error 4: Duplicated definition in 'type UINT as uinteger'

Please teach me some knowledge.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Window9 - FBGUI library for windows 2

Post by VANYA »

Makoto WATANABE wrote:I tested samples of "SetComboBoxItemText", "SetListBoxItemText" and "SetItemListBox" of window9 with Freebasic1.00.1.
A following error was displayed .

C:\Tool\FreeBASIC\inc\win\windef.bi(81) error 4: Duplicated definition in 'type UINT as uinteger'

Please teach me some knowledge.
Hi Makoto!

The problem with headers from windows и zlib. This is a problem of a general nature and not the library window9. I think that for many it will arise, if they start to use windef.bi and zlib.bi

Solution: Alternatively you can copy your old header zlib.bi in folder inc/.
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Window9 - FBGUI library for windows 2

Post by Makoto WATANABE »

Dear VANYA .

Thanks for your quick reply.
I replaced the "zlib.bi" with "version 1.2.6, January 29th, 2012".
I could successfully use "SetComboBoxItemText" etc.
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: Window9 - FBGUI library for windows 2

Post by enform »

Hi Vanya

In this code ,I cannot manage the 2nd combobox ( Gadget_4 ) in the events do loop . Probably because it is in a Groupgadget ?
I added a callback but it is the same thing . The 1st combobox is catched in events .
(This code is made essentially automatically )

Code: Select all

    ' combotest
 
#Include Once "window9.bi"
 
Enum
	Gadget_1 = 1001
	Gadget_2 = 1002
	Gadget_3 = 1003
	Gadget_4 = 1004
End Enum
 
Dim Shared As Handle group3
Dim Shared As HWND hwndWindow_0
 
Function OpenWindow_Window_0( ) As HWND
	hwndWindow_0 = OpenWindow("",10,10,500,300)
	WindowColor(hwndWindow_0,BGR(210,210,210))
	SetGadgetFont(,CInt(LoadFont("Courier new",8)))
	UseGadgetList(hwndWindow_0)
 
	ButtonGadget(Gadget_1,10,10,60,20)
	ComboBoxGadget(Gadget_2,85,10,60,21)
 
	group3 = GroupGadget(Gadget_3,165,10,106,60)
	UseGadgetList(group3)
	ComboBoxGadget(Gadget_4,10,10,85,21)
	UseGadgetList(hwndWindow_0)
 
	Return hwndWindow_0
End Function

Function cback (hwnd As HWND,msg As UINT,wParam As WPARAM,lParam As LPARAM ) As Integer
		Select Case msg
			Case WM_COMMAND
				Select Case LoWord(wParam)
					Case 1001
						? "1001 selected"
					Case 1002
						? "1002 selected"
					Case 1004
						? "1004 selected"
				End Select
		End Select
	Return 0
End Function


hwndWindow_0 = OpenWindow_Window_0()
 
SetWindowCallback(CInt(@cback()),0) 
' code MAIN
 
' endcode MAIN
 
 
Do
	Var event = WaitEvent
	If event = eventgadget Then
		?  event,EventGadget,EventNumber : Sleep 200 'EventNumber '"chg nsamples"

	EndIf
	Select Case event
			Case EventClose
			End
		Case EventGadget
			Select Case EventNumber
				Case 0
			End Select
	End Select
Loop
'

VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Window9 - FBGUI library for windows 2

Post by VANYA »

Hi enform!

GroupGadget - it is not a separate container, and simply frame (decoration). In the library you can use it like this:

Code: Select all

        ' combotest
     
    #Include Once "window9.bi"
     
    Enum
        Gadget_1 = 1001
        Gadget_2 = 1002
        Gadget_3 = 1003
        Gadget_4 = 1004
    End Enum
     
    Dim Shared As Handle group3
    Dim Shared As HWND hwndWindow_0
     
    Function OpenWindow_Window_0( ) As HWND
        hwndWindow_0 = OpenWindow("",10,10,500,300)
        WindowColor(hwndWindow_0,BGR(210,210,210))
        SetGadgetFont(,CInt(LoadFont("Courier new",8)))
        UseGadgetList(hwndWindow_0)
     
        ButtonGadget(Gadget_1,10,10,60,20)
        ComboBoxGadget(Gadget_2,85,10,60,21)
        group3 = GroupGadget(Gadget_3,165,10,106,60)
        ComboBoxGadget(Gadget_4,175,30,85,21)
     
        Return hwndWindow_0
    End Function

    Function cback (hwnd As HWND,msg As UINT,wParam As WPARAM,lParam As LPARAM ) As Integer
            Select Case msg
                Case WM_COMMAND
                    Select Case LoWord(wParam)
                        Case 1001
                            ? "1001 selected"
                        Case 1002
                            ? "1002 selected"
                        Case 1004
                            ? "1004 selected"
                    End Select
            End Select
        Return 0
    End Function


    hwndWindow_0 = OpenWindow_Window_0()
     
    SetWindowCallback(CInt(@cback()),0)
    ' code MAIN
     
    ' endcode MAIN
     
     
    Do
        Var event = WaitEvent
        If event = eventgadget Then
            ?  event,EventGadget,EventNumber : Sleep 200 'EventNumber '"chg nsamples"

        EndIf
        Select Case event
                Case EventClose
                End
            Case EventGadget
                Select Case EventNumber
                    Case 0
                End Select
        End Select
    Loop
    '

     
If you will be using in your code, you have to catch events gadgets in the window procedure GroupGadget , applying the method subclassing
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: Window9 - FBGUI library for windows 2

Post by enform »

Ok , you remove the UseGadgetList(s) , i see they are not needed in this code , but it is why i said before the code is 'automatically'
made by my form maker .
In a real code , i need several Groups and UseGadgetList(s) .
You say GroupGadget is a decoration , but the first combo (1002) gives normal events and the second combo in the Group
doesn't . With this difference and the need of subclassing , is it called a simple decoration ? :)

Thank you for the so fast answer , I'll see for the subclassing .
Have a nice day .
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

OpenFileRequester

Post by enform »

Hi Vanya,
Recently , i've been working again on OpenFileRequester because the 'bug' occured even without using a debugger .
The problem depends on the name ... apparently .
After modifs on the type of parameters , a specific file 'preampli.net' is correctly openned now .
The 2 codes : OpenFileRequester1 modified and 'preampli.net' for tests .
Wait and see ... %-)

OpenFileRequester1.bas

Code: Select all

# Include "window9.bi"

Dim shared filename999143525664741_ As ZString * 1000   '000  ' why 1000000 ? 
     ' (renamed with a '1' at the end for tests)

Function OpenFileRequester1 Alias "OpenFileRequester"(ByVal Title As String,ByVal curentdir As String, ByVal Pattern As String,ByVal flag As Integer=0, ByVal templateName As String = "") As String Export
  'Dim fbguiTemp As Integer   ' why 
	Dim ofn  As OPENFILENAME 
  filename999143525664741_ =  templateName
  With ofn
    .hwndOwner       = 0
    .lStructSize     = SizeOf(OPENFILENAME)
    .lpstrFilter     = StrPtr(Pattern)  '  GOOD  and no warning at compilation
'    .lpstrFilter     =  Cast(lpstr,@Pattern)  '  bad pattern , no warning
'    .lpstrFilter     =  @Pattern              '  bad pattern ,  warning 
    .lpstrFile       = @filename999143525664741_
    .nFileOffset     = 0
    .nMaxFile        = SizeOf(filename999143525664741_ )
    .lpstrFileTitle  = StrPtr(Title)   ' NULL      GOOD with the 2 values
'    .lpstrFileTitle  =  Cast(lpstr,@Title)   ' 
    .nMaxFileTitle   = SizeOf(Title)  '  works with 0 
    .lpstrInitialDir = StrPtr(curentdir)  ' GOOD
    .lpstrTitle      = StrPtr(Title)   ' GOOD 
'    .lpstrTitle      =  Cast(lpstr,@Title)  ' bad title 
'    .lpstrTitle      =  @Title  ' bad title , warning
    .Flags           = OFN_EXPLORER Or OFN_FILEMUSTEXIST Or OFN_OVERWRITEPROMPT Or flag
  End With

  if( GetOpenFileName( @ofn ) = 0 ) then
    Return ""
  Else
    Return filename999143525664741_
  end If
End Function



Var ddd = OpenFileRequester1 ("", "C: \", "Text files (*. Txt, *. Ini, *. Doc,*.Net)" _
+ Chr (0) + "*. Txt; *. Ini; *. Doc,*.Net" + Chr (0),0)
'+ Chr (0) + "*. Txt; *. Ini; *. Doc" + Chr (0), OFN_ALLOWMULTISELECT)

? ddd

If ddd <> "" Then
While ddd <> ""

ddd = NextSelectedFilename ()
? ddd
Wend
EndIf
sleep

preampli.net

Code: Select all

*PADS2000*
*D:\Projects\LTPcbNetlist\preampli1.asc Sat Nov 07 14:53:26 2015*
*PART*
R1	3k
R2	33k
R3	10k
V2	12v
V1	0
Q1	BC337-40
Q2	2N930A
Q3	2N2484
R7	22k
R8	22k
M1	IRF530
M2	IRF9640
J1	2N4416
J2	2N5462
C1	10µ

*NET*
*SIGNAL* N001
R1.1 R2.1 V2.1 R7.1 R8.1 M2.1 J2.1
*SIGNAL* N002
R1.2 Q1.1
*SIGNAL* N005
R2.2 R3.1 Q1.2 Q2.2 Q3.2 M1.2 M2.2 J1.2 J2.2
C1.1
*SIGNAL* 0
R3.2 V2.2 V1.2 Q1.3 Q2.3 Q3.3 M1.3 J1.3
*SIGNAL* N008
V1.1 C1.2
*SIGNAL* N003
Q2.1 R7.2
*SIGNAL* N004
Q3.1 R8.2
*SIGNAL* N006
M1.1 M2.3
*SIGNAL* N007
J1.1 J2.3
*END*

VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: OpenFileRequester

Post by VANYA »

enform wrote:Hi Vanya,
Recently , i've been working again on OpenFileRequester because the 'bug' occured even without using a debugger .
The problem depends on the name ... apparently .
After modifs on the type of parameters , a specific file 'preampli.net' is correctly openned now .
The 2 codes : OpenFileRequester1 modified and 'preampli.net' for tests .
Wait and see ... %-)

OpenFileRequester1.bas

Code: Select all

# Include "window9.bi"

Dim shared filename999143525664741_ As ZString * 1000   '000  ' why 1000000 ? 
     ' (renamed with a '1' at the end for tests)

Function OpenFileRequester1 Alias "OpenFileRequester"(ByVal Title As String,ByVal curentdir As String, ByVal Pattern As String,ByVal flag As Integer=0, ByVal templateName As String = "") As String Export
  'Dim fbguiTemp As Integer   ' why 
	Dim ofn  As OPENFILENAME 
  filename999143525664741_ =  templateName
  With ofn
    .hwndOwner       = 0
    .lStructSize     = SizeOf(OPENFILENAME)
    .lpstrFilter     = StrPtr(Pattern)  '  GOOD  and no warning at compilation
'    .lpstrFilter     =  Cast(lpstr,@Pattern)  '  bad pattern , no warning
'    .lpstrFilter     =  @Pattern              '  bad pattern ,  warning 
    .lpstrFile       = @filename999143525664741_
    .nFileOffset     = 0
    .nMaxFile        = SizeOf(filename999143525664741_ )
    .lpstrFileTitle  = StrPtr(Title)   ' NULL      GOOD with the 2 values
'    .lpstrFileTitle  =  Cast(lpstr,@Title)   ' 
    .nMaxFileTitle   = SizeOf(Title)  '  works with 0 
    .lpstrInitialDir = StrPtr(curentdir)  ' GOOD
    .lpstrTitle      = StrPtr(Title)   ' GOOD 
'    .lpstrTitle      =  Cast(lpstr,@Title)  ' bad title 
'    .lpstrTitle      =  @Title  ' bad title , warning
    .Flags           = OFN_EXPLORER Or OFN_FILEMUSTEXIST Or OFN_OVERWRITEPROMPT Or flag
  End With

  if( GetOpenFileName( @ofn ) = 0 ) then
    Return ""
  Else
    Return filename999143525664741_
  end If
End Function



Var ddd = OpenFileRequester1 ("", "C: \", "Text files (*. Txt, *. Ini, *. Doc,*.Net)" _
+ Chr (0) + "*. Txt; *. Ini; *. Doc,*.Net" + Chr (0),0)
'+ Chr (0) + "*. Txt; *. Ini; *. Doc" + Chr (0), OFN_ALLOWMULTISELECT)

? ddd

If ddd <> "" Then
While ddd <> ""

ddd = NextSelectedFilename ()
? ddd
Wend
EndIf
sleep

preampli.net

Code: Select all

*PADS2000*
*D:\Projects\LTPcbNetlist\preampli1.asc Sat Nov 07 14:53:26 2015*
*PART*
R1	3k
R2	33k
R3	10k
V2	12v
V1	0
Q1	BC337-40
Q2	2N930A
Q3	2N2484
R7	22k
R8	22k
M1	IRF530
M2	IRF9640
J1	2N4416
J2	2N5462
C1	10µ

*NET*
*SIGNAL* N001
R1.1 R2.1 V2.1 R7.1 R8.1 M2.1 J2.1
*SIGNAL* N002
R1.2 Q1.1
*SIGNAL* N005
R2.2 R3.1 Q1.2 Q2.2 Q3.2 M1.2 M2.2 J1.2 J2.2
C1.1
*SIGNAL* 0
R3.2 V2.2 V1.2 Q1.3 Q2.3 Q3.3 M1.3 J1.3
*SIGNAL* N008
V1.1 C1.2
*SIGNAL* N003
Q2.1 R7.2
*SIGNAL* N004
Q3.1 R8.2
*SIGNAL* N006
M1.1 M2.3
*SIGNAL* N007
J1.1 J2.3
*END*

Hi enform! You have updated your version of the library? I had already corrected in the past or previous versions.
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: Window9 - FBGUI library for windows 2

Post by enform »

probably not updated ... sorry ;-)
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Re: Window9 - FBGUI library for windows 2

Post by super_castle »

Hi, I've been using the latest FreeBasic is 1.04.0. always these messages:
--------------------------------------------------------
D:\FreeBASIC\fbc -s gui "OpenGLGadget_3D.bas"
OpenGLGadget_3D.o:fake:(.text+0x20f): undefined reference to `OpenWindow@36'
-------------------------------------------------------
------------------------------------------------------
D:\FreeBASIC\fbc -s gui "AddSysTrayIcon.bas"
AddSysTrayIcon.o:fake:(.text+0xa8): undefined reference to `OpenWindow@36'
AddSysTrayIcon.o:fake:(.text+0xfa): undefined reference to `MENUITEM(int, HMENU__*, FBSTRING, int)@24'
AddSysTrayIcon.o:fake:(.text+0x147): undefined reference to `ADDSYSTRAYICON@24'
AddSysTrayIcon.o:fake:(.text+0x1e4): undefined reference to `REPLACESYSTRAYICON@20'
----------------------------------------------------
.......................
.........................
........................

why is that?

i have win7

thanks
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: Window9 - FBGUI library for windows 2

Post by VANYA »

Hi, I've been using the latest FreeBasic is 1.04.0. always these messages:
Hi super_castle!

Bugs will be fixed after the release of the compiler version 1.05
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Re: Window9 - FBGUI library for windows 2

Post by super_castle »

Hello, thank you.

greeting
WQ1980
Posts: 48
Joined: Sep 25, 2015 12:04
Location: Russia

Re: Window9 - FBGUI library for windows 2

Post by WQ1980 »

libwindow9.a for FB 1.04
http://rghost.ru/74FGLnxPY
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Re: Window9 - FBGUI library for windows 2

Post by super_castle »

hello, thank you, now it works.

greeting
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Branch became active again after changing the design of the forum. This makes me happy :)
Post Reply