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
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: FBGUI library for windows 2

Post by D.J.Peters »

Hello VANYA
if i use the source code from http://free-basic.ru/user-files/Project.zip i get one error.

the HWND parm are different

Code: Select all

...
compile: TextPrinter.bas
compile: ToolBarToolTip.bas
ToolBarToolTip.bas(68) error 1: Argument count mismatch in 'Function ToolBarTool
Tip(ByVal buttonID As Integer,ByVal toolTipS_ As String) As Integer Export'
###################
# compile error ! #
###################
windows9.bi

Code: Select all

Declare Function ToolBarToolTip(ByVal Hwnd As Hwnd,ByVal buttonID As Integer,ByVal toolTipS As String) As Integer
ToolBartooltip.bas

Code: Select all

Function ToolBarToolTip(ByVal buttonID As Integer,ByVal toolTipS_ As String) As Integer Export
Jonge
Posts: 130
Joined: Jul 17, 2012 17:51
Location: Norway
Contact:

Re: FBGUI library for windows 2

Post by Jonge »

That's the same errors I got, those are fixed in the source you find on the SF page
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

D.J.Peters wrote:if i use the source code from http://free-basic.ru/user-files/Project.zip i get one error...
Hello Joshy!

I forgot to update the files on those links. Thanks for the post, now there is also updated.
I3I2UI/I0
Posts: 90
Joined: Jun 03, 2005 10:39
Location: Germany

Re: FBGUI library for windows 2

Post by I3I2UI/I0 »

Hi,
an example of a splash screen with a transparent background.
This tip worked: http://www.codeproject.com/Tips/141076/ ... nGL-window

Code: Select all

#Include "window9.bi"
#Include "GL/glut.bi"

Dim Shared As Integer OpenGL = 1

Sub RenderScene
  Static i As Single
  glClear GL_COLOR_BUFFER_BIT Or GL_DEPTH_BUFFER_BIT
  glPushMatrix

  glLoadIdentity
  glTranslatef 0.0, 0.0, -3.0
  glRotatef i, 0, 1, 0

  glBegin GL_TRIANGLES
  glColor3f   1.0, 0.0, 0.0     'Red
  glVertex3f  0.0, 1.0, 0.0     'Top Of Triangle Front
  glColor3f   0.0, 1.0, 0.0     'Green
  glVertex3f -1.0,-1.0, 1.0     'Left Of Triangle Front
  glColor3f   0.0, 0.0, 1.0     'Blue
  glVertex3f  1.0,-1.0, 1.0     'Right Of Triangle Front
  glColor3f   1.0, 0.0, 0.0     'Red
  glVertex3f  0.0, 1.0, 0.0     'Top Of Triangle  Right
  glColor3f   0.0, 0.0, 1.0     'Blue
  glVertex3f  1.0,-1.0, 1.0     'Left Of Triangle Right
  glColor3f   0.0, 1.0, 0.0     'Green
  glVertex3f  1.0,-1.0,-1.0     'Right Of Triangle Right
  glColor3f   1.0, 0.0, 0.0     'Red
  glVertex3f  0.0, 1.0, 0.0     'Top Of Triangle Back
  glColor3f   0.0, 1.0, 0.0     'Green
  glVertex3f  1.0,-1.0,-1.0     'Left Of Triangle Back
  glColor3f   0.0, 0.0, 1.0     'Blue
  glVertex3f -1.0,-1.0,-1.0     'Right Of Triangle Back
  glColor3f   1.0, 0.0, 0.0     'Red
  glVertex3f  0.0, 1.0, 0.0     'Top Of Triangle Left
  glColor3f   0.0, 0.0, 1.0     'Blue
  glVertex3f -1.0,-1.0,-1.0     'Left Of Triangle Left
  glColor3f   0.0, 1.0, 0.0     'Green
  glVertex3f -1.0,-1.0, 1.0     'Right Of Triangle Left
  glEnd
  glPopMatrix
  i = i + 2.0f
  OpenGLGadgetSwapBuffers opengl
End Sub

'http://www.codeproject.com/Tips/141076/Transparent-OpenGL-window
Var win = OpenWindow ("", 0,0,640,480,  WS_POPUP Or WS_VISIBLE, WS_EX_LAYERED )
SetLayeredWindowAttributes(win, 0, 0, LWA_COLORKEY)
CenterWindow win

OpenGLGadget(OpenGL, 0, 0, WindowClientWidth(win), WindowClientHeight(win))

'glEnable GL_ALPHA_TEST
glEnable GL_DEPTH_TEST
'glEnable GL_COLOR_MATERIAL

'Transparent-OpenGL-window
'glEnable GL_BLEND
'glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA
glClearColor 0, 0, 0, 0

Do
  Var event = WindowEvent
  If event = EventClose Then End
  If EventKEY = 27 Then End 'ESC -Taste
  RenderScene
  Sleep  1
Loop
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

Hello I3I2UI/I0!

I did not know anything about this, but here article (on russian) , that explains how it can be implemented
I3I2UI/I0
Posts: 90
Joined: Jun 03, 2005 10:39
Location: Germany

Re: FBGUI library for windows 2

Post by I3I2UI/I0 »

VANYA wrote:I did not know anything about this, but here article (on russian) , that explains how it can be implemented
Nice article, but I read nothing about the implementation in window9.
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

I3I2UI/I0 wrote: Nice article, but I read nothing about the implementation in window9.
Of course there is no window9, paper is designed for C++, but it is the method of implementation.

P.S. functions OpenGlGadget involved DJPeters, I wrote in the help that my knowledge of this surface
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

Super. Very nice to use FreeBasic
with this library.
Big thank you.
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

Hello,
With EventKey, it is impossible to see if the é key (for example) has been pressed.
Image
It works with uppercase and numbers only.
Is it possible to overcome it to intercept any key ?
In advance, thank you for your reply.
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

bob2 wrote: Is it possible to overcome it to intercept any key ?
In advance, thank you for your reply.
Hi!

Try our GetAsyncKeyState:

Code: Select all

#Include "window9.bi" 
Do
	Cls
	Print "Press ESC to exit"
Loop Until GetAsyncKeyState(&h1b)<0
All key codes
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

OK thank you. I understand better what it is: Virtual-Key Codes
But when I write a TextGadget (for example):
é è
I get characters like this:
Image
Should I change the font or should make adjustments?
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

Oh! I found using:
ASCIITOUTF (Text)
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

Hello,
with :
Var handle=Create_File("essai.txt")
If handle Then
Write_StringN(handle,"Paris")
Write_StringN(handle,"Londres")
EndIf
Close_file(handle)
one obtains:
Image

Can anyone tell me: how to add a line in that file already created? for :
Image
How when we reopened the file? Write_StringN(handle,"Moscou") crushes "Paris" and "Londres"

D'avance, merci
VANYA
Posts: 1839
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: FBGUI library for windows 2

Post by VANYA »

bob2 wrote: Can anyone tell me: how to add a line in that file already created?
Hello!

Code: Select all

#Include "window9.bi"

Var handle=Create_File("essai.txt")
If handle<>-1 Then
 Write_StringN(handle,"Paris")
 Write_StringN(handle,"Londres")
 Close_file(handle)
EndIf


handle = Open_File("essai.txt")
If handle<>-1 Then
	Set_File_Pointer(handle,0,FILE_END)
	Write_StringN(handle,"Moscow")
	Close_file(handle)
EndIf
bob2
Posts: 40
Joined: Sep 27, 2012 18:29

Re: FBGUI library for windows 2

Post by bob2 »

OK ! Again thank you.
Post Reply