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
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FBGUI library for windows 2

Post by Lothar Schirm »

Vanya, has this code been tested successfully in an other version of Windows? Which version? Will window9 be tested for further versions of Windows and will it be supported in future, e.g. for further FreeBasic compiler versions?

I like your library very much, I have just begun to use it. I have become very quickly familiar with the syntax, because I have used PureBasic for two years. For me, your library is a strong motivation to use FreeBasic again more intensively. It is much easier to handle than WX-C or GTK+ and has an excellent help file. And it creates much less and readable code compared with FireFly. But if window9 has not been tested successfully with Windows 8, I should better stay with PureBasic.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Lothar Schirm wrote:Vanya, has this code been tested successfully in an other version of Windows? Which version? Will window9 be tested for further versions of Windows and will it be supported in future, e.g. for further FreeBasic compiler versions?

I like your library very much, I have just begun to use it. I have become very quickly familiar with the syntax, because I have used PureBasic for two years. For me, your library is a strong motivation to use FreeBasic again more intensively. It is much easier to handle than WX-C or GTK+ and has an excellent help file. And it creates much less and readable code compared with FireFly. But if window9 has not been tested successfully with Windows 8, I should better stay with PureBasic.
I already wrote in my last post, that at this moment I can not provide support for a system of windows 8. According to some sources, Microsoft is preparing to release a free version of windows 8 with Bing. If this becomes a reality, then the library will be tested on windows 8. Currently I support the only systems: Windows XP, Windows 7.

And yes, for future versions of the compiler, I plan to implement support for library

Added Last:

I download a trial version windows 8 And he placed in a virtual environment VirtualBox.

Example (EditorGadget ReadOnlyEditor) you gave, works fine.
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FBGUI library for windows 2

Post by Lothar Schirm »

Your link is a download of Windows 8.1 Enterprise Evaluation. Maybe ReadOnlyEditor works with Windows 8.1? But with all other functions of your library which I used I had no problems. It's good news that you will support window9 in future. What is the official name? Window9 or FBGUI 2? Thank you and good success!

Edit: Style = ES_READONLY works! Problem is solved for me.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Lothar Schirm wrote:What is the official name? Window9 or FBGUI 2?
window9
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Produced a small but important fix library.

1) Deleted: the transition between the gadgets on TAB (conflict with EditorGadget)
2) Fixed other bugs
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FBGUI library for windows 2

Post by Lothar Schirm »

Thank you for your work! Hot stuff, I love it! It's so easy to write a simple GUI application with very few lines of code. Example: a small calculator:

Code: Select all

'===============================================================================
' Minirechner.bas
' Erstellt am 20.03.2014
'===============================================================================

#Include "Window9.bi"

Dim As Integer event

Enum
  'Gadgets:
  Text_a
  String_a
  Text_b
  String_b
  Text_c
  String_c
  Button_Plus
  Button_Minus
  Button_Mult
  Button_Div
End Enum


Sub OpenWindow_Main()
  'Fenster
  
  CenterWindow(OpenWindow("Mini-Rechner", 0, 0, 270, 150))
  TextGadget(Text_a, 20, 20, 80, 20, "Zahl 1")
  TextGadget(Text_b, 20, 50, 80, 20, "Zahl 2")
  TextGadget(Text_c, 20, 80, 80, 20, "Ergebnis")
  StringGadget(String_a, 110, 20, 80, 20, "0")
  StringGadget(String_b, 110, 50, 80, 20, "0")
  StringGadget(String_c, 110, 80, 80, 20, "0")
  ButtonGadget(Button_Plus, 200, 20, 20, 20, "+")
  ButtonGadget(Button_Minus, 230, 20, 20, 20, "-")
  ButtonGadget(Button_Mult, 200, 50, 20, 20, "*")
  ButtonGadget(Button_Div, 230, 50, 20, 20, "/")
  
End Sub


Sub Rechne(RZ As String)
  'Zahlen auslesen, rechnen, Ergebnis anzeigen:
  
  Dim As Double a, b, c
  
  a = Val(GetGadgetText(String_a))
  b = Val(GetGadgetText(String_b))
    
  Select Case RZ
  Case "+"
    c = a + b
  Case "-"
    c = a - b
  Case "*"
    c = a * b
  Case "/"
    c = a / b
  End Select
  
  SetGadgetText(String_c, Str(c)) 
  
End Sub


' Hauptprogramm:

OpenWindow_Main()

Do
  event = WaitEvent
  Select Case EventNumber
  Case Button_Plus
    Rechne("+")
  Case Button_Minus
    Rechne("-")
  Case Button_Mult
    Rechne("*")
  Case Button_Div
    Rechne("/")
  End Select
Loop Until event = EventClose

End

  
And a small painting program:

Code: Select all

'===============================================================================
' MausMaler_win9.bas
' Erstellt am 14.03.2014
'===============================================================================

#Include "Window9.bi"


Dim HWND As hwnd
Dim As Integer Farbe = &HFF0000, x1, y1, x2, y2, LBDown = 0, event

Enum
	MenuItem_Farbe
	MenuItem_Ende
End Enum


Function Open_Window() As hwnd
	
	Var HWND = OpenWindow("MausMaler", 0, 0, 640, 480)
	CenterWindow(HWND)
	Var hMessages = Create_Menu()
	Var MenName = MenuTitle(hMessages, "Datei")
	MenuItem(MenuItem_Farbe, MenName, "Farbe")
	MenuItem(MenuItem_Ende, MenName, "Ende")
	
	Return HWND

End Function


HWND = Open_Window()

Do

	event = WaitEvent()
	
	Select Case event
	
		Case EventMenu
			Select Case EventNumber
				Case MenuItem_Farbe
					'Farbauswahl:
					Farbe = ColorRequester()
				Case MenuItem_Ende
				'Ende:
					End
			End Select
		
		Case EventLBDown
			'Maus gedrueckt: Zeichnen neu beginnen
			WindowStartDraw(HWND, 0, 0, 640, 480, 1, 0) 
			LBDown = 1
			x1 = MouseX
			y1 = MouseY
			PixDraw(x1, y1, Farbe)
			StopDraw
			 									
		Case EventLBUp
			'Maus losgelassen: Zeichnen unterbrechen
			LBDown = 0
						
		Case EventMouseMove
			
			If LBDown Then
				'zeichnen, so lange Maus gedrueckt:
			  WindowStartDraw(HWND, 0, 0, 640, 480, 1, 0) 
				x2 = MouseX
				y2 = MouseY
				If Farbe = &HFFFFFF Then
					'Weiss: breite Linie zum Loeschen
					LineDraw(x1, y1, x2, y2, 10, Farbe)
				Else
					'normale Linienbreite
					LineDraw(x1, y1, x2, y2, 0, Farbe)
				End If
				x1 = x2
				y1 = y2
				StopDraw
			End If
		
	End Select
	
Loop Until event = EventClose

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

Re: FBGUI library for windows 2

Post by VANYA »

I'm glad you like
super_castle
Posts: 289
Joined: Oct 10, 2006 7:19

Re: FBGUI library for windows 2

Post by super_castle »

hello, good day.
wehre is the help for win9 in englisch ?

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

Re: FBGUI library for windows 2

Post by VANYA »

super_castle wrote:hello, good day.
wehre is the help for win9 in englisch ?

greeting
Hi super_castle!
http://sourceforge.net/projects/guiwind ... p/download
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Post by enform »

Hi Vanya ,

I cannot compile TreeViewGadget example with fbc 091 but it works with fbc090 .

( With the last version of your lib in .../lib and .../inc , just downloaded ).

build line cde : fbc -s GUI

The code with compiler errors at the end in comments :

Code: Select all

#Include "window9.bi"

enum gadgets
  tview = 1
end enum
    
Dim As Integer event

var win  = OpenWindow("TreeView",10,10,180,200) : CenterWindow(win)

var bmp1 = Extract_Icon("Shell32.DLL",  3)
var bmp2 = Extract_icon("Shell32.DLL", 45)

var tree = TreeViewGadget(tview,10,10,140,140, TVS_HASLINES or TVS_HASBUTTONS or TVS_LINESATROOT,WS_EX_CLIENTEDGE,32)

Var tvitempos = AddTreeViewItem(tview,"1",bmp1,bmp2,1)
AddTreeViewItem(tview,"1-1",bmp1,bmp2,1,tvitempos)

tvitempos=AddTreeViewItem(tview,"2",bmp1,bmp2,4)
AddTreeViewItem(tview,"2-1",bmp1,bmp2,3,tvitempos)

Do
  var event = waitevent
  If event = EventClose Then 
    end
  end if
Loop


'TreeviewGadget.o:fake:(.text+0xf2): undefined reference to `ADDTREEVIEWITEM(int, FBSTRING, HBITMAP__*, HBITMAP__, int, int)@24'
'TreeviewGadget.o:fake:(.text+0x108): undefined reference to `ADDTREEVIEWITEM(int, FBSTRING, HBITMAP__*, HBITMAP__, int, int)@24'
'TreeviewGadget.o:fake:(.text+0x122): undefined reference to `ADDTREEVIEWITEM(int, FBSTRING, HBITMAP__*, HBITMAP__, int, int)@24'

'Build error(s)
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Hi enform!

Version 0.91 didn't release. I can't rely on test versions and third-party assemblies when testing library. The reasons can be much which do such behavior (there are no libraries in assembly, change in operation of the compiler and so forth). I can only advise you to collect library the test compiler 0.91. If it doesn't help, we will wait for official release of the compiler.
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Post by enform »

Not a problem , i will wait
Lothar Schirm
Posts: 436
Joined: Sep 28, 2013 15:08
Location: Germany

Re: FBGUI library for windows 2

Post by Lothar Schirm »

I think FB 0.91 seems to be buggy, see also http://www.freebasic.net/forum/viewtopi ... AP#p192140. I use 0.90
enform
Posts: 185
Joined: Apr 24, 2011 12:57
Location: France

Re: FBGUI library for windows 2

Post by enform »

Hi Vanya ,

A question about results with GadgetY() of a gadget at position : x = 10 , y = 20 in 4 cases :
- a gadget in a window
- a gadget in a group
- a gadget in a panel
- a gadget in a panel + in a group

With GadgetY() , 1 result ( 10,20 ) is not correct ( 10,22 ) .
In this code , Function Gadget_Y is your Function GadgetY with a modif in a line ' Return ' .
Can you confirm , or not , please ?

Code: Select all

#include once "window9.bi"
Dim As HWND win , tex , group ,gpan , strin , pan0 , pan1
Dim Shared As RECT FWRECT,FCRECT
Dim Shared As WINDOWINFO  FWINFO

Function Gadget_Y(ByVal gadget As Integer) As Long Export

Dim As RECT FWRECT,FCRECT
	Dim As WINDOWINFO  FWINFO
	Dim iMetrics As Integer
	GetWindowRect(GadgetID(gadget),@FCRECT)
	Var parent = GetParent(Cast(HWND,GadgetID(gadget)))
	If(GetWindowRect(parent,@FWRECT)) Then
		If GetParent(parent)<>0 Then
			Return FCRECT.top - FWRECT.top
		EndIf
		FWINFO.cbSize=Len(WINDOWINFO)
		If(GetWindowInfo(parent,@FWINFO)) Then
			If GetWindowLong(parent,GWL_STYLE) And WS_POPUP Then
			else	
				iMetrics = GetSystemMetrics(SM_CYCAPTION)
			EndIf
			if GetMenu(parent)<>0 then
				Return FCRECT.top - FWRECT.top - FWINFO.cyWindowBorders-iMetrics-20
			Else
				Return FCRECT.top - FWRECT.top - FWINFO.cyWindowBorders-iMetrics
			endif
		Else
			Return -1
		EndIf
	Else
		Return FCRECT.top
	End If
End Function

win = OpenWindow("",00,00,500,500) 
tex = TextGadget(1,10,20,80,20)

group = GroupGadget (2,10,100,150,50, "Group")
UseGadgetList (group)
strin = StringGadget (3,10,20,80,20, "3")

UseGadgetList (win)
PanelGadget (4,10,200,200,200, 16)
pan0 = AddPanelGadgetItem (4,0, "0")
UseGadgetList (pan0)
StringGadget (5,10,20,80,20, "5")

pan1 = AddPanelGadgetItem (4,1, "1")
UseGadgetList (pan1)
gpan = GroupGadget (6,10,10,150,100, "Gpan")
UseGadgetList (gpan)
StringGadget (7,10,20,80,20, "7")

	GetWindowRect(tex,@FWRECT)
	GetClientRect(tex,@FCRECT)
	FWINFO.cbSize=Len(WINDOWINFO)
	'? FWINFO.cyWindowBorders
 '		If(GetWindowRect(win,@FWRECT)) Then
	'	If GetParent(parent)<>0 Then
	? FWRECT.left ,FWRECT.top ,FWRECT.right,FWRECT.bottom
	? FCRECT.left ,FCRECT.top ,FCRECT.right,FCRECT.bottom
	?
	GetWindowRect(group,@FWRECT)
	GetClientRect(group,@FCRECT)
	FWINFO.cbSize=Len(WINDOWINFO)

	? FWRECT.left ,FWRECT.top ,FWRECT.right,FWRECT.bottom
	? FCRECT.left ,FCRECT.top ,FCRECT.right,FCRECT.bottom
	?
	GetWindowRect(strin,@FWRECT)
	GetClientRect(strin,@FCRECT)
	FWINFO.cbSize=Len(WINDOWINFO)

	? FWRECT.left ,FWRECT.top ,FWRECT.right,FWRECT.bottom
	? FCRECT.left ,FCRECT.top ,FCRECT.right,FCRECT.bottom
	
 '	?  FWRECT.top - FCRECT.top
 '?
 '? GetSystemMetrics(SM_CYCAPTION)
 '? GetSystemMetrics(SM_CYMENU)
 '? GetSystemMetrics(SM_CYBORDER)
 '? GetSystemMetrics(SM_CYFRAME)
 '? GetSystemMetrics(SM_CYSIZEFRAME)
 '? GetSystemMetrics(SM_CYSIZE)
 ?
 Do
Var event = WaitEvent ()
If event = eventclose Then End
If event = EventGadget Then 
	' SetGadgetText 1 , Str(GlobalMouseX) + " , " + Str(GlobalMouseY)
	 SetGadgetText 1 , Str(GadgetX(1)) + " , " + Str(Gadget_Y(1))
	 SetGadgetText 3 , Str(GadgetX(3)) + " , " + Str(Gadget_Y(3))
	 SetGadgetText 5 , Str(GadgetX(5)) + " , " + Str(Gadget_Y(5))
	 SetGadgetText 7 , Str(GadgetX(7)) + " , " + Str(Gadget_Y(7))
	
EndIf
Loop

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

Re: FBGUI library for windows 2

Post by VANYA »

Hi enform!

You are using the latest version of the library? I corrected in the latest version of this bug. GadgetY function now looks like this:

Code: Select all

Function GadgetY(ByVal gadget As Integer) As Long Export
	Dim As RECT  r
	Dim As Point pt
	GetWindowRect(GadgetID(gadget),@r)
	pt.x = r.left: pt.y = r.top
	ScreenToClient(GetParent(GadgetID(gadget)),@pt)
	Return pt.y
End Function
Post Reply