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
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

GUI library for Windows \ Linux (window9)

Post by VANYA »

Library of functions under Windows and Linux which are very similar both on a title, and on ease of use at commands (function) PureBasic. Help on functions with examples is applied. Source codes also available.
Even if at you the allergy to other programming languages, many functions will be useful for interface development under Windows or Linux. UNICODE supported.

The project is on Souceforge

Page dedicated to the library with some examples and screenshots:

https://users.freebasic-portal.de/freeb ... start.html

The installation of the library:

Windows:

1) Put files libwindow9.a in the folder: compilier\lib\win32 OR compilier\lib\win64

2) Put files extwstring.bi , Window9.bi in the folder: compilier\inc

In the Windows maybe need a library zlib . You can also take ready-made files zlib from here

Linux (with standard compiler installation):

1) Put files libwindow9.a in the folder: /usr/local/lib/freebasic/linux-x86 OR /usr/local/lib/freebasic/linux-x86_64

2) Put files window9.bi , extwstring.bi , keys.bi in the folder: /usr/local/include/freebasic

In the Linux may have to install dependencies from dev versions: gtk (I suggest GTK2) , zlib, webkitgtk , ...

Functions are at present implemented:
StartPrinter
StopPrinter
FramePage
PrintText
PrintImage
ColorPrinter
FontPrinter
GetRealSize
GetCountLine
GetFullSize
GetLenString
GetCountDoc
DocumentStart
DocumentEnd
PageStart
PageEnd
WindowEvent
WaitEvent
EventNumber
MouseX
MouseY
EventHwnd
EventKEY
EventNumberToolBar
EventNumberListView
EventNumberTreeView
EventWParam
EventLParam
OpenWindow
Close_Window
DisableWindow
HideWindow
CenterWindow
WindowColor
UseGadgetList
SizeX
SizeY
ResizeWindow
WindowX
WindowY
WindowWidth
WindowHeight
WindowClientWidth
WindowClientHeight
WindowBounds
SetWindowTop
SetTransparentWindow
WindowBackgroundImage
AddKeyboardShortcut
DeleteAllKeyboardShortcut
IsMouseOver
ID_In_Number
GadgetID
FreeGadget
GadgetX
GadgetY
GadgetWidth
GadgetHeight
ResizeGadget
DisableGadget
HideGadget
GetGadgetText
SetGadgetText
GetGadgetState
SetGadgetState
GetGadgetAttribute
SetGadgetAttribute
SetGadgetColor
GetGadgetColor
UpdateItem
StatusBarGadget
RemoveStatusbar
SetStatusBarField
ToolTipStatusBar
ComboBoxGadget
ShowListComboBox
LenItemTextComboBox
AddComboBoxItem
DeleteComboBoxItem
GetComboBoxText
CountItemComboBox
ResetAllComboBox
FindItemComboBox
SetItemComboBox
GetItemComboBox
FileComboBoxItem
ComboBoxImageGadget
GetHimageCombo_
AddComboBoxImageItem
SetComboBoxItemText
ListBoxGadget
AddListBoxItem
DeleteListBoxItem
FileListBoxItem
FindItemListBox
CountItemListBox
SetSelectManyItem
SetColumnWidthListBox
SetItemListBox
GetItemListBox
GetSelCountListBox
GetListBoxText
LenItemTextListBox
GetTopIndexListBox
SetTopIndexListBox
ResetAllListBox
SetListBoxItemText
ListViewGadget
AddListViewColumn
AddListViewItem
GetSubItemListView
GetItemListView
FlagKeyListView
GetColumnListView
DeleteListViewItemsAll
DeleteItemListView
DeleteIndexImageListView
DeleteListViewColumn
GetColumnWidthListView
GetItemCountListView
GetTextItemListView
SetColumnWidthListView
GetSelectedCountListView
ReplaceTextItemListView
ReplaceTextColumnListView
ReplaceImageListView
SetSelectListViewItem
TrackBarGadget
SetTrackBarPos
GetTrackBarPos
SetTrackBarMaxPos
SetTrackBarMinPos
CalendarGadget
DateCalendarGadget
GetStateCalendar
SetStateCalendar
TreeViewGadget
AddTreeViewItem
AddTreeViewItem
GetItemTreeView
DeleteTreeViewItem
GetCountItemTreeView
ReplaceImageItemTreeView
ReplaceImageItemTreeView
RenameItemTreeView
GetIndexImageTreeView
GetTextTreeView
MoveItemTreeView
IpAddressGadget
SetIpAddress
GetIpAddress
CreateToolBar
ToolBarStandardButton
ToolBarImageButton
DeleteButtonToolBar
SetButtonToolBarState
GetButtonToolBarState
CountButtonToolBar
ToolBarToolTip
SetToolBarToolTipFont
SetToolBarToolTipColor
GetToolBarTextButton
SetToolBarButtonSize
ToolBarSeparator
ImageGadget
SetImageGadget
Load_imageA
Load_image
Catch_Image
Catch_ImageA
LoadImageFromResource
LoadImageFromResourceA
Free_Image
FreeGpBitmap
IMAGE_HEIGHT
IMAGE_WIDTH
Image_WidthA
Image_HeightA
Resize_image
Resize_imageA
Copy_imageA
COPY_image
SAVE_image
SAVE_imageA
Grab_Image
Grab_imageA
CreateCopyImageWindow
CreateCopyImageWindowClient
CreateCopyImageDesktop
CreateCopyImageRect
Create_Image
Create_ImageA
CreateHBitmapFromGpBitmap
CreateGPBitmapFromHBitmap
Rotate4_Image
RotateAndScaleImage
RotateAndScaleImageA
CreateIconOrCursorFromFile
CreateIconOrCursorFromBitmap
CreateIconOrCursorFromGpBitmap
SaveIconOrCursor
load_Icon
Extract_Icon
ButtonImageGadget
ButtonGadget
CheckBoxGadget
TextGadget
OptionGadget
StringGadget
HyperLinkGadget
SpinGadget
GroupGadget
ProgressBarGadget
SetRangeProgressBar
SetXProgressBarColor
WebGadget
WebGadgetNavigate
WebGadgetGoForward
WebGadgetGoBack
WebGadgetRefresh
WebGadgetGetURL
WebGadgetState
WebGadgetStop
WebGadgetGetBody
WebGadgetSetBody
GadgetToolTip
DelToolTip
DisableToolTip
GetToolTipText
SetToolTipText
Create_Menu
CreatePopMenu
CreateIconItemMenu
MenuTitle
MenuItem
MenuItem
Insert_Menu
Insert_Menu
MenuBar
OpenSubMenu
Delete_Menu
HideMenu
FreeMenu
Modify_Menu
Modify_Menu
DeleteItemMenu
SetStateMenu
GetStateMenu
GetMenuItemText
DisplayPopupMenu
MenuBackColor
OpenFileRequester
NextSelectedFilename
SaveFileRequester
ShellFolder
ColorRequester
MessBox
InputBox
LoadFont
SetGadgetFont
FontRequester
SelectedFontColor
SelectedFontName
SelectedFontSize
SelectedFontStyle
GetClipBoardText
SetClipBoardText
GetClipBoardImage
SetClipBoardImage
ClearClipBoard
Create_File
Open_File
Read_File
Close_File
Size_File
E_O_F
Get_File_Pointer
Set_File_Pointer
Read_Character
Read_Byte
Read_WORD
Read_Integer
Read_Single
Read_Double
Read_LONGINT
Read_Data
Read_DataA
Read_DataS
Read_String
Write_Character
Write_Byte
Write_Word
Write_Integer
Write_Single
Write_Double
Write_String
Write_StringN
Write_Longint
Write_Data
CreateDir
RemoveDir
GetCurentDir
SetCurentDir
GetWindowsDir
GetSystemDir
GetTempDir
GetSpecialFolder
CopyDir
MoveDir
RenameDir
DeleteDir
GetExtensionPart
GetPathPart
GetFilePart
ExamineDirectory
NextDirectoryEntry
FinishDirectory
DirectoryEntrySize
DirectoryEntryDate
DirectoryEntryName
DirectoryEntryAttributes
LoadMovie
FreeMovie
PlayMovie
StopMovie
PauseMovie
ResizeMovie
SetRateMovie
GetRateMovie
GetEndPosMovie
MovieSetPositions
MovieGetCurrentPosition
MovieSourseWidth
MovieSourseHeight
MovieFullScreen
MovieAudioSetVolume
MovieAudioGetVolume
MovieScreenShot
MovieGetState
ImageStartDraw
WindowStartDraw
StopDraw
LineDraw
PixDraw
GetPix
BoxDraw
RoundBoxDraw
RoundDraw
CircleDraw
FontDraw
TextDraw
PolylineDraw
ImageDraw
FillRectDraw
FocusDraw
IconDraw
GradientFillDraw
PieDraw
ImageStartDrawA
StopDrawA
LineDrawA
BoxDrawA
BezierDrawA
RoundDrawA
CircleDrawA
ArcDrawA
PieDrawA
PolygonDrawA
SetPixA
GetPixA
CurveDrawA
CreateBrushA
CreateFontDrawA
FreeFontDrawA
FreeBrushA
TextDrawA
ImageDrawA
ModeDrawA
FillRectDrawA
OpenGLGadget
OpenGLGadgetMakeCurrent
OpenGLGadgetSwapBuffers
EnumSettingsDisplay
ResetEnum
SetCurrentSettingsDisplay
GetCurrentSettingsDisplay
GetWidthDesktop
GetHeightDesktop
GetBitsDesktop
GetFrequencyDesktop
GlobalMouseX
GlobalMouseY
ScrollBarGadget
GetScrollGadgetRange
GetScrollGadgetRange
SetScrollGadgetRange
SetScrollGadgetRange
GetScrollGadgetPos
GetScrollGadgetPos
SetScrollGadgetPos
SetScrollGadgetPos
SetScrollGadgetPage
SetScrollGadgetPage
SetPageStepScrollBar
AddSysTrayIcon
ReplaceSysTrayIcon
DeleteSysTrayIcon
ClientMDIGadget
MDIGadget
HWNDPrinter
TextPrinter
ContainerGadget
GroupContainerGadget
PanelGadget
AddPanelGadgetItem
DeleteItemPanelGadget
PanelGadgetGetCursel
PanelGadgetSetCursel
EditorGadget
UndoEditor
RedoEditor
PasteEditor
CanUndoEditor
CanRedoEditor
EmptyUndoBufferEditor
GetLineTextEditor
GetLineCountEditor
GetModifyEditor
GetRectEditor
SetLimitTextEditor
SetModifyEditor
SetPasswordChar
GetPasswordChar
LineFromCharEditor
LineIndexEditor
LineLengthEditor
LineScrollEditor
SetTabStopsEditor
ReadOnlyEditor
GetFirstVisibleLineEditor
SetRectEditor
GetCurrentIndexCharEditor
SetTransferTextLineEditorGadget
GetSelectTextEditorGadget
SetSelectTextEditorGadget
RebarGadget
AddRebarTab
GetCountTabRebarGadget
GetHeightRebarGadget
GetTextRebarGadget
SetTextRebarGadget
MoveTabRebarGadget
DeleteTabRebarGadget
IDinIndexRebarGadget
CreateFBini
OpenFBini
CloseFBini
WriteGroupFBini
WriteValueFBini
WriteValueFBini
WriteValueFBini
WriteValueFBini
WriteValueFBini
WriteValueFBini
ReadByteValueFBini
ReadShortValueFBini
ReadIntegerValueFBini
ReadLongintValueFBini
ReadDoubleValueFBini
ReadStringValueFBini
GetCurrentFileName
GetCurrentFileNameA
SetRunOnlyExe
InitProcess
FirstProcess
NextProcess
GetNameProcess
GetIDProcess
Create_Process
Open_Process
KillProcess
WaitExitProcess
WaitLoadProcess
GetExitCode
CompressMem
DeCompressMem
CompressFile
DeCompressFile
ASCIITOUTF
UTFTOASCII
FastCopy
FastCRC32
AESEncoder
AESDecoder
Encode64
Decode64
MD5createFileHash
MD5createHash
SHA512create
SHA512createFile
SHA1createFile
SHA1create
PeekS
RunProgram
ReplaceString
InsertString
LtrimA
RtrimA
TrimA
ClearString
SetWindowCallback
FreeCallback
IncludeBinary
SelectElement
AddElement_B
AddElement_Sh
AddElement_S
AddElement_L
AddElement_In
AddElement_D
NewList
DeleteElement
SizeList
DeleteList
ClearList
LastElement
FirstElement
NextElement
PrevElement
SetValueElement_SH
SetValueElement_B
SetValueElement_In
SetValueElement_S
SetValueElement_D
SetValueElement_L
GetList_SH
GetList_B
GetList_D
GetList_L
GetList_S
GetList_In
SetList_SH
SetList_B
SetList_In
SetList_S
SetList_D
SetList_L
GetValueElement_S
GetValueElement_In
GetValueElement_L
GetValueElement_D
GetValueElement_B
GetValueElement_SH
InsertElement_S
InsertElement_In
InsertElement_L
InsertElement_B
InsertElement_SH
InsertElement_D
AddElementHead_B
AddElementHead_S
AddElementHead_L
AddElementHead_D
AddElementHead_In
AddElementHead_SH
MoveElement
GetWindowText
SetIconGadget
SetWindowStyle
SetGadgetStyle
ExplorerListGadget
GetExplorerListGadgetHwnd
GetExplorerListGadgetPath
SetExplorerListGadgetPath
SetExplorerListGadgetSort
GetExplorerListGadgetCurentItem
SetExplorerListGadgetStyle
GetClipBoardFile
SetClipBoardFile
OpenHelp
CloseHelp
InetOpen
OpenUrl
InetReadFile
InetFreeHandle
GetHTTPHeader
ReceiveHTTPFile
GetContentSize
UrlEncoder
UrlDecoder
GetClassName_
DeleteToolBar
GetSelectedListViewItem
Last edited by VANYA on Jan 01, 2023 9:55, edited 41 times in total.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

I downloaded the source code. Several files had names the operating system I'm using (windows 7) did not recognize. The comments inside the source code I cannot read. I am using a unicode aware editor (it 'understands' files encoded in utf8/utf16/utf32 little/big endian).

I tried google translate to find out the encoding used (by pasting some comments from the source code) but I could not find out the encoding (I expected it to be some kind of cyrillic encoding or utf8).

Apart from that some functions had names that were not in english.

English is not my native language. Everything I write that I post on this forum is in english (knowing that few people understand my first language which is Dutch). I know writing in a language other than your first language is not an easy thing to do.

And if you want me or others to read/use files published by you then please make sure I can read the names of the files and their content. Encoding it as UTF8 would help a lot as google translate will at the very least help a little with translation of text to english.

I appreciate the source code. And the language... it´s russian, right?(znachenie = meaning, spiski=lists).
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

I downloaded the source code. Several files had names the operating system I'm using (windows 7) did not recognize.
I too use Windows 7. Which files aren't recognized?
The comments inside the source code I cannot read. I am using a unicode aware editor (it 'understands' files encoded in utf8/utf16/utf32 little/big endian).
If there are questions under source codes, I will try to explain as a smog. In the code it is better not to look at comments.... Though on будующее I will mean.
I tried google translate to find out the encoding used (by pasting some comments from the source code) but I could not find out the encoding (I expected it to be some kind of cyrillic encoding or utf8).
Yes I from Russia. It will be heavy to read help on functions, but examples I think will help. For each function there is an example and I plan and not to depart from this rule further.
Apart from that some functions had names that were not in english.
I will consider and I will try in будующем to make names of functions exceptional in English
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

Has updated the project. Functions are added:
CreateToolBar
ToolBarStandardButton
ToolBarImageButton
DeleteButtonToolBar
SetButtonToolBarState
GetButtonToolBarState
CountButtonToolBar
ToolBarToolTip
SetToolBarToolTipFont
SetToolBarToolTipColor
GetToolBarTextButton
SetToolBarButtonSize
ToolBarSeparator
CreateDir
RemoveDir
GetCurentDir
SetCurentDir
GetWindowsDir
GetSystemDir
GetTempDir
GetSpecialFolder
CopyDir
MoveDir
RenameDir
DeleteDir
GetExtensionPart
GetPathPart
GetFilePart
GroupGadget
Extract_Icon
ShellFolder
RunProgram
Small example of animation in a window:

[Contains sexually implict anime image: http://s44.radikal.ru/i105/1101/c4/9a65abb2a01b.jpg]

http://mneniya.ucoz.ru/FREEBASIC/Public/Animation.zip

http://users.freebasic-portal.de/vanya/ ... mation.zip

Code: Select all

#Include "window9.bi"
Dim As Integer index,aTimer=1
Dim  As Integer ArrayImage(1 to 8)
For index=1 To 8
	ArrayImage(index)= Load_image("Anim\" &  index & ".bmp")
Next
Var hwnd1=OpenWindow("animation",10,10,255,228)
CenterWindow(hwnd1)
ImageGadget(1,0,0,240,230)
SetTimer(hwnd1,1,100,0)
Do
	Var 	ev=WindowEvent
	If ev=EventClose Then End
	If ev=eventtimer Then
		Select Case aTimer
			Case 1 To 8
				SetImageGadget(1,ArrayImage(aTimer))
				aTimer+=1
				If aTimer=9 Then aTimer=1
		End Select
	EndIf
Loop
Last edited by VANYA on Jan 10, 2011 18:11, edited 1 time in total.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Post by AGS »

I did not have a look at the documentation until today. The html pages are encoded using cyrillic (windows 1251). And google translate is doing a rather good job on translating those help files.

The source package, when unpacked, contains two folders. One of the folders is called Windows. The other is called 滿߬¿

Inside the folder 滿߬¿ there are five files:
ÅÓ¿¼ÑÓ.bas
ÅÓ¿¼ÑÓ1.bas
ÅÓ¿¼ÑÓ2.bas
ÅÓ¿¼ÑÓ3.bas
ÅÓ¿¼ÑÓ4.bas

Other file names are shown as expected (these have english names).

I'm using windows 7 pro (dutch version).
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

The project has been updated. Added Function:
ExamineDirectory
NextDirectoryEntry
FinishDirectory
DirectoryEntrySize
DirectoryEntryDate
DirectoryEntryName
DirectoryEntryAttributes
ListViewGadget
AddListViewColumn
AddListViewItem
GetSubItemListView
GetItemListView
FlagKeyListView
GetColumnListView
DeleteListViewItemsAll
DeleteItemListView
DeleteIndexImageListView
DeleteListViewColumn
GetColumnWidthListView
GetItemCountListView
GetTextItemListView
SetColumnWidthListView
GetSelectedCountListView
ReplaceTextItemListView
ReplaceTextColumnListView
ReplaceImageListView
UpdateItem
GetClipBoardText
SetClipBoardText
GetClipBoardImage
SetClipBoardImage
Full list at the top. Fixed some bugs. Fixed file names linked lists. Help just updated and still with examples.
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

The project has been updated. Added Function:
ResizeWindow
WindowX
WindowY
WindowWidth
WindowHeight
WindowBounds
SetWindowTop
SetTransparentWindow
WindowBackgroundImage
SetTrackBarMaxPos
SetTrackBarMinPos
ProgressBarGadget
SetRangeProgressBar
ClearClipBoard
LoadMovie
FreeMovie
PlayMovie
StopMovie
PauseMovie
ResizeMovie
SetRateMovie
GetRateMovie
GetEndPosMovie
MovieSetPositions
MovieGetCurrentPosition
MovieSourseWidth
MovieSourseHeight
MovieFullScreen
MovieAudioSetVolume
MovieAudioGetVolume
MovieScreenShot
MovieGetState
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

Example of a simple player.
Plays: MP3,WAV,AVI,WMV,MPG,MP4,FLV,MOV,VOB,GIF

Code: Select all

#Include "window9.bi" 

Dim Shared As Integer hwnd,event,mov8,MOV_FLAG
hwnd=OpenWindow("Video",10,10,350,350) : CenterWindow(hwnd)
ButtonGadget(1,10,280,20,20,"X"):GadgetToolTip(1,"STOP")
ButtonGadget(2,40,280,20,20,"|>"):GadgetToolTip(2,"PLAY")
ButtonGadget(3,70,280,20,20,"||"):GadgetToolTip(3,"PAUSE")
ButtonGadget(6,100,280,20,20,"<<"):GadgetToolTip(6,"Playback speed")
ButtonGadget(7,130,280,20,20,">>"):GadgetToolTip(7,"Increase the playback speed")
ButtonGadget(8,160,280,20,20,"+"):GadgetToolTip(8,"Open File")
ImageGadget(4,6,0,320,240)
TrackBarGadget(5,5,250,320,20,0,10,TBS_NOTICKS  ) 

Sub resize
 Static As integer Width_,height
 If  Width_<>WindowWidth(hwnd)-30 Or height<>WindowHeight(hwnd)-110 Then
  Width_=WindowWidth(hwnd)-30 : height=WindowHeight(hwnd)-110
  ResizeGadget(4,,,Width_,height)
  If MOV_FLAG=1 Then
   ResizeMovie(mov8,0,0,width_,height-30)
  endif
  Var resH=WindowHeight(hwnd)-70
  ResizeGadget(1,,resH)
  ResizeGadget(2,,resH)
  ResizeGadget(3,,resH)
  ResizeGadget(5,,resH-30,width_)
  ResizeGadget(6,,resH)
  ResizeGadget(7,,resH)
  ResizeGadget(8,,resH)
 EndIf
 If MOV_FLAG=1 Then
  SetTrackBarPos(5,Int(MovieGetCurrentPosition(mov8)/1000000))
 EndIf
End Sub
SetTimer(hwnd,1,10,@resize)
Do
 event=WindowEvent()
 If Event=EventClose Then Exit Do
 If event=EventGadget Then
  Select case EventNumber
   Case 1 : If mov8 Then stopmovie(mov8)
   Case 2 : If mov8 Then Playmovie(mov8):SetRateMovie(mov8,1)
   Case 3 : If mov8 Then Pausemovie(mov8)
   case 5
    If GetAsyncKeyState(1)<0 Then
     if mov8 Then
      MovieSetPositions(mov8,cast(double,getTrackBarPos(5))*1000000,GetEndPosMovie(mov8) )
     EndIf
    EndIf
   Case 6 : If mov8 Then SetRateMovie(mov8,GetRateMovie(mov8)-0.5)
   Case 7 : If mov8 Then SetRateMovie(mov8,GetRateMovie(mov8)+0.5)
   Case 8
    Var OFR = OpenFileRequester("","C:\","Media files (*.avi, *.mp3, *.wmv, *.wav, *.mp4, *.mp2, *.mp1)"+Chr(0)+"*.avi; *.mp3; *.wmv; *.wav; *.mp4; *.mp2; *.mp1"+Chr(0))
    If OFR<>"" Then
     If mov8 Then
      FreeMovie(mov8)
     EndIf
     mov8=loadmovie(GadgetID(4),OFR,0,0,WindowWidth(hwnd)-30,WindowHeight(hwnd)-110)
     SetTrackBarMaxPos(5,Int(GetEndPosMovie(mov8)/1000000 ))
     Playmovie(mov8):SetRateMovie(mov8,1)
     MOV_FLAG=1
    EndIf
  End Select
 EndIf
Loop
if mov8 then FreeMovie(mov8)

Rens
Posts: 256
Joined: Jul 06, 2005 21:09

Post by Rens »

This is awesome.

I just found it yesterday. I like it very, very much.
Simple to use and has all the gadgets i want.
This is the Gui i was looking for.

Thanks you very much for this fantastic Gui.

Please keep developing this one!

Это является удивительным.

Я только что узнал это вчера. Мне нравится очень, очень много.
Простой в использовании и имеет все гаджеты я хочу.
Это я Gui искал.

Спасибо вам большое за этот фантастический Гуй.

Пожалуйста, имейте развивающихся этом!

Может быть, маленькая хитрость:

A little trick:

Code: Select all

#Include "window9.bi"

Dim As integer hwnd1,hMessages,MenName,MenName1,eventx,hbit

' Enum is the way to use controls with a name.
' The advantage of this is that you do not have to rememeber wich control has which number!

enum
   
   buttongadget_1=1
   buttongadget_2    ' enum will give buttongadget_2 the value 2  and stringgadget_2 the value 3
   stringgadget_1
   
   /'
      At this place add controls at will, enum will give them a number
      Ofcourse you can change the numbering like buttongadget_1=7
      numbering will then start from 7 (8,9,10 etc)
   
      or
   
      buttongadget_1=100 ' buttongadgets starts at number 100
      buttongadget_2
      
      stringgadget_1=200 'stringgadgets starts at number 200
      stringgadget_2
      
   '/
   
end enum

'window just like fb 800x600
dim as string windowtitle_
windowtitle_="Enum Example"
hwnd1=OpenWindow(windowtitle_,0,0,805,625)

' stringgadget
StringGadget(stringgadget_1,10,10,500,20,"Click on a button",ES_READONLY)

' buttongadget number 1
ButtonGadget(buttongadget_1,10,40,60,30,"button1")

' buttongadget number 2
ButtonGadget(buttongadget_2,10,70,60,30,"button2")

Do 
   var event=WindowEvent()
   select case event
      case EventClose
         end
      case Eventgadget
         select case eventnumber
            case buttongadget_1
               MessBox("Button","Number 1 clicked")
            case buttongadget_2
               MessBox("Button","Number 2 clicked")
         End Select
         
   end select
Loop
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

Rens wrote:This is awesome.

I just found it yesterday. I like it very, very much.
Simple to use and has all the gadgets i want.
This is the Gui i was looking for.

Thanks you very much for this fantastic Gui.

Please keep developing this one!

Это является удивительным.

Я только что узнал это вчера. Мне нравится очень, очень много.
Простой в использовании и имеет все гаджеты я хочу.
Это я Gui искал.

Спасибо вам большое за этот фантастический Гуй.

Пожалуйста, имейте развивающихся этом!

Может быть, маленькая хитрость:

A little trick:

Code: Select all

#Include "window9.bi"

Dim As integer hwnd1,hMessages,MenName,MenName1,eventx,hbit

' Enum is the way to use controls with a name.
' The advantage of this is that you do not have to rememeber wich control has which number!

enum
   
   buttongadget_1=1
   buttongadget_2    ' enum will give buttongadget_2 the value 2  and stringgadget_2 the value 3
   stringgadget_1
   
   /'
      At this place add controls at will, enum will give them a number
      Ofcourse you can change the numbering like buttongadget_1=7
      numbering will then start from 7 (8,9,10 etc)
   
      or
   
      buttongadget_1=100 ' buttongadgets starts at number 100
      buttongadget_2
      
      stringgadget_1=200 'stringgadgets starts at number 200
      stringgadget_2
      
   '/
   
end enum

'window just like fb 800x600
dim as string windowtitle_
windowtitle_="Enum Example"
hwnd1=OpenWindow(windowtitle_,0,0,805,625)

' stringgadget
StringGadget(stringgadget_1,10,10,500,20,"Click on a button",ES_READONLY)

' buttongadget number 1
ButtonGadget(buttongadget_1,10,40,60,30,"button1")

' buttongadget number 2
ButtonGadget(buttongadget_2,10,70,60,30,"button2")

Do 
   var event=WindowEvent()
   select case event
      case EventClose
         end
      case Eventgadget
         select case eventnumber
            case buttongadget_1
               MessBox("Button","Number 1 clicked")
            case buttongadget_2
               MessBox("Button","Number 2 clicked")
         End Select
         
   end select
Loop
I'm glad you enjoyed it.
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

The project has been updated. Added features:
CreateCopyImageWindow
CreateCopyImageWindowClient
CreateCopyImageDesktop
CreateCopyImageRect
Create_Image
ImageStartDraw
WindowStartDraw
StopDraw
LineDraw
PixDraw
GetPix
BoxDraw
RoundBoxDraw
RoundDraw
CircleDraw
FontDraw
TextDraw
PolylineDraw
ImageDraw
FillRectDraw
EnumSettingsDisplay
ResetEnum
SetCurrentSettingsDisplay
GetCurrentSettingsDisplay
GetWidthDesktop
GetHeightDesktop
GetBitsDesktop
GetFrequencyDesktop
ReplaceString
SetWindowCallback
FreeCallback
IsMouseOver
Editor FbEdit does not take a number of functions (crashes), so now have to compile a library of BAT files (available in the archive)
Imortis
Moderator
Posts: 1948
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Post by Imortis »

May I ask what version of FB you are using? When I go to compile library, I get hundreds of warning messages:

Implicit Conversion
Passing Scalar as pointer
Function result was not explicitly set


all of the above kinds.

It seems that you need to cast many variables, and make sure to return something in each function.
Rens
Posts: 256
Joined: Jul 06, 2005 21:09

Post by Rens »

@VANYA

I was just going to ask you for drawing routines. It is if you read my mind.
I see it is already done.
Excellent!!!

Btw: Everything works great.

But i have some questions:

#1
What is "+ &" ?
because when i click the topic in the html help file i get an error about a webpage in my browser.

#2
How can i load a background and after that draw something on it?

Code: Select all

#Include "window9.bi"

Dim Shared As integer hwnd
Dim Shared As Integer hwToolBar
Dim As integer hMessages,MenName,MenName1,eventx,hbit

hwnd=OpenWindow("test",0,0,805,625)
CenterWindow(cast(hwnd,hwnd))
setwindowtop(hwnd,0)

Var bitmap = Load_image("test.jpg")
WindowBackgroundImage(hwnd,bitmap,1)

WindowStartDraw(hwnd) 
   BoxDraw(340,380,150,150,50000,50000)
   LineDraw(340,380,340+150,380+150,2,bgr(255,0,0))',&hff0000)
StopDraw

Do 
   
   var event=WindowEvent()
   
   select case event
      
      case EventClose
         end
      
   end select
         
Loop
This doesn't work, i only see the background image?

#3
Can i wait for a picture gadget like in visual basic?

picture1.cls
for n=1 to 10
picture1.line (n*50,0)-(n*50,100),&hFF00&
next

Is not a big deal, because i can get around it, but maybe it's nice to have one.

@Imortis

If you do it like this, you get a few errors (if you do'nt cast):

Dim Shared As integer hwnd
Dim Shared As Integer hwToolBar
Dim As integer hMessages,MenName,MenName1,eventx,hbit

Then these are the things you have to cast:

CenterWindow(cast(hwnd,windows(1).handle))
hidewindow(cast(hwnd,windows(1).handle),1)

Maybe some more, but until now i came up to only these two

I get no errors at all.

Just a little - bare - demo:

Code: Select all

#Include "window9.bi"
Dim Shared As integer hwnd
Dim Shared As Integer hwToolBar
Dim As integer hMessages,MenName,MenName1,eventx,hbit

'window
hwnd=OpenWindow("test",0,0,805,625)
CenterWindow(cast(hwnd,hwnd))
setwindowtop(hwnd,0)

Do 
   
   var event=WindowEvent()
   
   'eventhandler
   select case event
      
      case WM_RBUTTONDOWN '     :)
         hidewindow(cast(hwnd,hwnd),1)
         
      'windowhandler
      case EventClose
         end
      
   end select
         
Loop
No toolbar or menu defined, just in case you need it

Note:
If you are going to use a toolbar then start your numbering of the gadgets with a number higher than the amount of toolbar pictures, otherwise there will be a clash between the toolbar and the gadgets.
And place the gadgets below the toolbar, not at the same height.

for ex.:

'toolbar
hwToolBar=CreateToolBar(,TBSTYLE_FLAT)
ToolBarStandardButton(hwToolBar,1,1)
ToolBarSeparator(hwToolBar)
ToolBarStandardButton(hwToolBar,2,4)
ToolBarStandardButton(hwToolBar,3,6)

If you use this, you have to start your gadgets with number 4

About the casting thing:
I know hwnd actually must be defined as HWND and maybe the menu things as HMENU , but i do'nt mind as long as i can cast things and do'nt see any errros after compiling :P

About colors:
You can use BGR if you are used to set colors with rgb(...,...,...)
BGR converts colors to rgb.
for ex.:

Code: Select all

WindowStartDraw(windows(1).handle)
   BoxDraw(340,380,150,150,50000,50000)
   For a=380 To 440 Step 3
      PixDraw(360,a,bgr(255,0,0)) '<------- Red, Blue, Green
   Next  
StopDraw
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

May I ask what version of FB you are using?
The latest version
I get hundreds of warning messages:
These errors was not until I compiled FbEdit. The time will come and see. In general, the library compiles and functions work correctly.
#1
What is "+ &" ?
because when i click the topic in the html help file i get an error about a webpage in my browser.
It is strange:

Image
#2
How can i load a background and after that draw something on it?

Code: Select all

#Include "window9.bi"

Dim Shared As integer hwnd
Dim Shared As Integer hwToolBar
Dim As integer hMessages,MenName,MenName1,eventx,hbit

hwnd=OpenWindow("test",0,0,805,625)
CenterWindow(hwnd)
setwindowtop(hwnd,0)

Var bitmap = Load_image("1.bmp")

hbit=COPY_image(bitmap)
ImageStartDraw(hbit) 
   BoxDraw(10,10,50,50,50000,50000)
   LineDraw(10,10,60,60,2,bgr(255,0,0))',&hff0000)
StopDraw
WindowBackgroundImage(hwnd,COPY_image(hbit),1)

Do 
   
   var event=WindowEvent()
   
   select case event
      
      case EventClose
         end
      
   end select
         
Loop
Can i wait for a picture gadget like in visual basic?
I do not know how it works in VisualBasic. Did ImageGadget and ButtonImageGadget not fit?
VANYA
Posts: 1841
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Post by VANYA »

Imortis! I believe that there is nothing wrong with that at the time of compiling some of the variables are not clearly defined. In the program it works properly. Try to compile the two files into one library, and you'll see the same mistakes, although the functions are written like correctly and working properly.
BAT:

Code: Select all

D:\Freebasic\fbedit\FreeBASIC\fbc.exe -lib Write_Word.bas Write_StringN.bas
if errorlevel 1 pause
pause
Post Reply