FBGUI library for windows 2

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
VANYA
Posts: 1272
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

FBGUI library for windows 2

Postby VANYA » Dec 22, 2010 15:22

Library of functions under Windows which are very similar both on a title, and on ease of use at commands (function) PureBasic. Help on functions with examples is applied. The initial project too is accessible.
Even if at you the allergy to other programming languages, many functions will be useful for interface development under Windows. It would be desirable to alter certainly linked lists to use the data types but while I am engaged in other functions, later I will probably be engaged.

The project is on Souceforge

Page dedicated to the library with some examples and screenshots:

http://users.freebasic-portal.de/freebasicru/w9start.html

Project Library 32\64 bit from Joshy

The installation of the library is described here:

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




Files of libraries and help on functions:

DOWNLOAD

MIRROR

The Sourse project:

DOWNLOAD

MIRROR

For all who want to help translate into their native language project file reference:

ProjectFileHelp

Program to Help

Game "15" By means of this library:

Code: Select all

#Include "window9.bi"

Enum
Button_0
Button_1
Button_2
Button_3
Button_4
Button_5
Button_6
Button_7
Button_8
Button_9
Button_10
Button_11
Button_12
Button_13
Button_14
Button_15
End Enum

Dim shared dvig As Integer
Dim As Integer event

Randomize Timer
SetGadgetFont(,LoadFont("arial",22,,,1))

Function Open_Window_0() As Integer
   Var hwnd=OpenWindow("Пятнашки", 516, 346, 340, 390 )
   CenterWindow(hwnd)

   ButtonGadget(Button_1, 5, 10, 75, 75, "1")
   ButtonGadget(Button_2, 85, 10, 75, 75, "2")
   ButtonGadget(Button_3, 165, 10, 75, 75, "3")
   ButtonGadget(Button_4, 245, 10, 75, 75, "4")
   ButtonGadget(Button_5, 5, 90, 75, 75, "5")
   ButtonGadget(Button_6, 85, 90, 75, 75, "6")
   ButtonGadget(Button_7, 165, 90, 75, 75, "7")
   ButtonGadget(Button_8, 245, 90, 75, 75, "8")
   ButtonGadget(Button_9, 5, 170, 75, 75, "9")
   ButtonGadget(Button_10, 85, 170, 75, 75, "10")
   ButtonGadget(Button_11, 165, 170, 75, 75, "11")
   ButtonGadget(Button_12, 245, 170, 75, 75, "12")
   ButtonGadget(Button_13, 5, 250, 75, 75, "13")
   ButtonGadget(Button_14, 85, 250, 75, 75, "14")
   ButtonGadget(Button_15, 165, 250, 75, 75, "15")
   Var menu=Create_Menu()         'Создаем меню
   Var menName= MenuTitle(menu,"Меню")
   MenuItem(1,menName,"Новая игра")
   MenuItem(2,menName,"Об игре")
   MenuBar(menName)
   MenuItem(3,menName,"Выход")

End Function

Function Pustoe_mesto(a As integer) As Integer
   Dim As Integer razmer_x,razmer_y,raz_x,raz_y,Schet,Schet1,Schet2,Schet3
   razmer_x = GadgetX(a)     'местонахождение гаджета
   razmer_y = GadgetY(a)

   For gad As Integer=1 To 15
      raz_x = GadgetX(gad)
      raz_y = GadgetY(gad)

      If razmer_x + 80 < 320 Then
         If razmer_x + 80 <> raz_x Or razmer_y <> raz_y then     ' проверка справа
            Schet=Schet+1
         EndIf
      EndIf

      If razmer_x - 80 >= 5 Then
         If razmer_x - 80 <> raz_x  Or razmer_y <> raz_y  Then       'проверка слева
            Schet1=Schet1+1
         EndIf
      EndIf


      If razmer_y + 80 < 325 Then
         If razmer_y + 80 <> raz_y  Or razmer_x <> raz_x Then        'проверка снизу
            Schet2=Schet2+1
         EndIf
      EndIf



      If razmer_y - 80 >= 10 Then
         If razmer_y - 80 <> raz_y  Or razmer_x <> raz_x Then          'проверка сверху
            Schet3=Schet3+1
         EndIf
      EndIf
   Next


   If Schet=15 Then
      dvig=1
   EndIf

   If Schet1=15 Then
      dvig=2
   EndIf

   If Schet2=15 Then
      dvig=3
   EndIf

   If Schet3=15 Then
      dvig=4

   EndIf

End Function

Function peremeshenie(a As integer,b As Integer)As Integer

   Select Case a
      Case 1
         ResizeGadget(b, GadgetX(b)+80)              'Перемещение кнопок
      Case 2
         ResizeGadget(b, GadgetX(b)-80)
      Case 3
         ResizeGadget(b,,GadgetY(b)+80)
      Case 4
         ResizeGadget(b,,GadgetY(b)-80)
   End Select
   dvig=0
End Function

Sub sluch()
   Dim  gadget As Integer
   For ww As Integer=1 To 2000

      gadget= Rnd*15               ' случайная расстановка
      If gadget=0 Then
         gadget=1
      EndIf
      Pustoe_mesto(gadget)
      peremeshenie(dvig,gadget)
   Next

End Sub



Open_window_0()
sluch()

Do

   event=WindowEvent()

   If event=EventGadget  Then
      For gadget As Integer=1 To 15
         If gadget = EventNumber    Then              ' Идентификация гаджета
            Pustoe_mesto(gadget)
            peremeshenie(dvig,gadget)
            Exit for
         EndIf
      Next
   EndIf


   If GadgetX(1)+GadgetY(1)=15 And GadgetX(2)+GadgetY(2)=95 And GadgetX(3)+GadgetY(3)=175 And GadgetX(4)+GadgetY(4)=255 Then
      If GadgetX(5)+GadgetY(5)=95 And GadgetX(6)+GadgetY(6)=175 And GadgetX(7)+GadgetY(7)=255 And GadgetX(8)+GadgetY(8)=335 Then
         If GadgetX(9)+GadgetY(9)=175 And GadgetX(10)+GadgetY(10)=255 And GadgetX(11)+GadgetY(11)=335 And GadgetX(12)+GadgetY(12)=415 Then
            If GadgetX(13)+GadgetY(13)=255 And GadgetX(14)+GadgetY(14)=335 And GadgetX(15)+GadgetY(15)=415 Then
               MessBox("Победа", "Молодец ты сумел(а) собрать пятнашку.")
               sluch()
            EndIf
         EndIf
      EndIf
   EndIf

   If event=EventMenu  Then 'события меню
      Select Case  EventNumber
         Case 1
            sluch()
         Case 2
            MessBox("Об игре", "Создано в Freebasic, автор: Станислав Будинов")
         Case 3
            End
      End Select
   EndIf
   
Loop Until event=EventClose


Image
Last edited by VANYA on Apr 04, 2018 6:36, edited 26 times in total.
AGS
Posts: 1284
Joined: Sep 25, 2007 0:26
Location: the Netherlands

Postby AGS » Jan 02, 2011 21:35

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

Postby VANYA » Jan 03, 2011 5:18

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

Postby VANYA » Jan 03, 2011 14:50

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

Postby AGS » Jan 04, 2011 5:16

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

Postby VANYA » Jan 10, 2011 14:18

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

Postby VANYA » Feb 05, 2011 18:33

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

Postby VANYA » Feb 06, 2011 4:33

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

Postby Rens » Feb 15, 2011 9:59

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

Postby VANYA » Feb 15, 2011 15:48

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

Postby VANYA » Feb 15, 2011 16:40

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
Posts: 1568
Joined: Jun 02, 2005 15:10
Location: USA
Contact:

Postby Imortis » Feb 16, 2011 5:11

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

Postby Rens » Feb 16, 2011 9:24

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

Postby VANYA » Feb 16, 2011 15:16

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

Postby VANYA » Feb 16, 2011 15:44

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

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 2 guests