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

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

Makoto WATANABE wrote: Apr 22, 2022 11:14 Dear VANYA;

Thank you for incorporating FreeBasic containers into window9.
By the way, I tested CreateHashTable and ConfigDeleteValue samples and got the following errors.
My ld.exe is the version 2021/07/09.
Please let me know how I can avoid the errors.

C:\Tool\FreeBASIC\bin\win32\ld.exe: CreateHashTable.o:fake:(.text+0x4d): undefined reference to `CREATEHASHTABLE@0'
C:\Tool\FreeBASIC\bin\win32\ld.exe: CreateHashTable.o:fake:(.text+0xcd): undefined reference to `SETVALUESTRHASHTABLE@12'

C:\Tool\FreeBASIC\bin\win32\ld.exe: ConfigDeleteValue.o:fake:(.text+0x50): undefined reference to `CONFIGCREATE@0'
C:\Tool\FreeBASIC\bin\win32\ld.exe: ConfigDeleteValue.o:fake:(.text+0xe2): undefined reference to `SETCONFIGVALUE@16'
Hi Makoto WATANABE!

I don't know what you did. Perhaps the compiler picks up an old version of the library that does not have these functions. You need to check again. Maybe you forgot to replace the libwindow9.a file

If you want, you can check how it works in my assembly. Just download, unzip, run the editor and try out the examples. If you need to use the unicode version of the library, then at the very beginning of the code add #DEFINE UNICODE.
antarman
Posts: 80
Joined: Jun 12, 2006 9:27
Location: Russia, Krasnodar

Re: GUI library for Windows \ Linux (window9)

Post by antarman »

Hi Vanya! Thank you for your lib! But in last i cant compile in x86. I get error massage:

B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(Window9.o):fake:(.text+0xc9e): undefined reference to `fb_ArrayErase@4'
B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(Window9.o):fake:(.text+0xd61): undefined reference to `fb_ArrayErase@4'
B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(Window9.o):fake:(.text+0xe9b): undefined reference to `fb_ArrayErase@4'
B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(AddKeyboardShortcut.o):fake:(.text+0x17a): undefined reference to `fb_ArrayErase@4'
B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(AddKeyboardShortcut.o):fake:(.text+0x20f): undefined reference to `fb_ArrayErase@4'
B:\Dev\FreeBASIC\bin\win32\ld.exe: B:\Dev\FreeBASIC\lib\win32/libwindow9.a(AddKeyboardShortcut.o):fake:(.text+0x21d): more undefined references to `fb_ArrayErase@4' follow

But if i compile in x64 that no problem...
Please help...
p.s.
fbc version 1.07.3
I use compiller with gcc:
fbc32 -s gui -gen gcc -Wc -Ofast -Wc -Wformat=0 -Wc -ffunction-sections -Wl -flto -Wl --gc-sections -Wl --strip-all
fbc64 -s gui -gen gcc -Wc -Ofast -Wc -Wformat=0 -Wc -ffunction-sections -Wl -flto -Wl --gc-sections -Wl --strip-all
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

antarman wrote: Apr 23, 2022 9:40 But in last i cant compile in x86. I get error massage:
Hi antarman!

I don't get such errors. I tried on the latest version 1.09 and also tried to use the compiler 1.07.1 instead of the latest version of the compiler (only the compiler! Tools, headers, etc. remain from version 1.09). Everything compiled with your options, I don't have any problems.

I use of. compiler branch:

FreeBASIC-1.09.0-winlibs-gcc-9.3.0.7z - combined 32bit and 64bit standalone version

system: windows 7 32-bit
antarman
Posts: 80
Joined: Jun 12, 2006 9:27
Location: Russia, Krasnodar

Re: GUI library for Windows \ Linux (window9)

Post by antarman »

Thank you very much. Now i back to version 2019-10-10...

I will see all your links and archives. Thanks for your help...
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Makoto WATANABE »

Dear VANYA;

Thanks for your quick reply.
As you say, surely I forgot to replace the libwindow9.a file.
I was wondering whether to use the Ascii or Unicode version of the libwindow9.a file, but now I'm using Ascii version.
My hash table test program worked fast.

Code: Select all

'HashTableTest1Window9
'Check for interference in hash generation
'キーに対する Hash 生成での干渉の有無チェック
'Hash によるデータの照合チェック
'Data collation check by Hash

' 辞書項目を登録
'Sub SetValueStrHashTable(p As Any Ptr , sKey As String , anyValue As USTRING)
' 設定済の索引のデータ取得。未登録のキーを検索すると空白を返します
'Function GetValueStrHashTable(p As Any Ptr , sKey As String) As USTRING  
' 項目を個別に消去
'Sub FreeKeyHashTable(p As Any Ptr , sKey As String , bFlagFreeMemoryStrings As Long = 0)
' 辞書データをまとめて消去
'Sub FreeHashTable(p As Any Ptr , bFlagFreeMemoryStrings As Long = 0)
' ハッシュテーブルを削除【必須】
'Sub DeleteHashTable(p As Any Ptr , bFlagFreeMemoryStrings As Long = 0)


#Include "window9.bi"

Dim p As Any Ptr = CreateHashTable()

Dim KeyString As String
Dim DataString As String
Dim As Integer Counter, i, j, k, l, m
Dim BoolVar As String
Dim As Single t1,t2,t3

'****************************************************************
'Hash generation for the key and checking for interference of the generated Hash
'キーに対する Hash 生成と、生成した Hash の干渉有無チェック
'****************************************************************
t1=Timer
Counter = 0
For i = Asc("A") To Asc("Z")
   Print Chr(i)+Space(1);
   For j = Asc("A") To Asc("Z")
      For k = Asc("A") To Asc("Z")
         For l = Asc("A") To Asc("Z")
            For m = Asc("A") To Asc("Z")
               KeyString =  Chr(i) + Chr(j) + Chr(k) + Chr(l) + Chr(m)
               DataString =  Chr(i) + Chr(j) + Chr(k) + Chr(l) + Chr(m)
               BoolVar = GetValueStrHashTable(p , KeyString) ' KeyStringの存在を確認

               If BoolVar = "" Then      '***********
                  Counter += 1
                  SetValueStrHashTable(p , KeyString, DataString)    '★★ データ追加★★★★★★★★★★
               Else
                  'キーの重複が発生したら表示する
                  Print
                  Print "Key Duplicate", Counter, KeyString
                  Sleep
               End If
            Next m
         Next l
      Next k
   Next j
Next i

Print
Print
Print "Data registration has been completed. KeyString = "; KeyString
Print "データ登録を終了しました。 KeyString = "; KeyString
Print "      Counter = 26^5(11,881,376) = "; Counter
t2=Timer
Print "Seconds for registration = ";t2 - t1
Print "登録所要秒数 = ";t2 - t1
Print
Print "*******************************************************"

'****************************************************************
'Delete and re-register data items
'データ項目を削除して再登録する
'****************************************************************

Print "Delete 26 keys."
Print "26 個のキーを削除します。"
Print
For i = Asc("A") To Asc("Z")
   KeyString =  Chr(i) + "AAAA"
   FreeKeyHashTable(p , KeyString , 1)     'キーを指定して、データ項目を個別に消去
   Print KeyString,
Next i
Print
Print "Count ="; GetSizeHashTable(p)
Print
Print "Add 26 keys."
Print "26 個のキーを追加します。"
Print
For i = Asc("A") To Asc("Z")
   KeyString =  Chr(i) + "AAAA"
   DataString =  Chr(i) + "AAAA"

   BoolVar = GetValueStrHashTable(p ,KeyString) ' KeyStringの存在を確認

   If BoolVar = "" Then      '***********
      Counter += 1
      SetValueStrHashTable(p, KeyString, DataString)    '★★ データ追加★★★★★★★★★★
      Print KeyString,
   Else
      'キーの重複が発生したら表示する
      Print
      Print "Key Duplicate", Counter, KeyString
      Sleep
   End If
Next i
Print
Print "Count ="; GetSizeHashTable(p) 

Print
Print "*******************************************************"

'****************************************************************
'Hash data collation check
'Hash によるデータの照合チェック
'****************************************************************

For i = Asc("A") To Asc("Z")
   Print Chr(i)+Space(1);
   For j = Asc("A") To Asc("Z")
      For k = Asc("A") To Asc("Z")
         For l = Asc("A") To Asc("Z")
            For m = Asc("A") To Asc("Z")
               KeyString =  Chr(i) + Chr(j) + Chr(k) + Chr(l) + Chr(m)
               DataString =  Chr(i) + Chr(j) + Chr(k) + Chr(l) + Chr(m)
               If DataString <> GetValueStrHashTable(p, KeyString) Then    ' Hash を使ってデータを照合
                  'データの不整合が発生したら表示する
                  Print
                  Print "Inconsistent data", KeyString, GetValueStrHashTable(p, KeyString)
                  Sleep
               End If
            Next m
         Next l
      Next k
   Next j
Next i

Print
t3=Timer
Print "Seconds for matching = ";t3 - t2
Print "照合所要秒数 = ";t3 - t2
Print
Print "Total seconds required = ";t3 - t1
Print "合計所要秒数 = ";t3 - t1
DeleteHashTable(p , 1)

Print "*******************************************************"
Print "Please enter any key to exit."
Print "何かキー入力すると終了します。"
Sleep
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Makoto WATANABE »

Dear VANYA;

I use window9 conveniently.
I usually compile with ShiftJIS code, but I tried compiling with UTF16 code for testing.
The "OpenFileRequester" code below shows the expected screen in ShiftJIS.
However, it did not display as expected in UTF16.

I am not at all troubled by this.
I would appreciate it if you could check this phenomenon when you have time and interest.

Code: Select all

   Var ddd = OpenFileRequester("Specify English text file",ExePath,"Text File(*.txt;*.csv;*.htm*)"_
   +Chr(0)+"*.txt;*.csv;*.htm*"+Chr(0)+"All File(*.*)"+Chr(0)+"*.*"+Chr(0))
Image

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

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

Hi Makoto WATANABE!

From help:

Description

Opens a dialog box for opening file(s). Attention: for the UNICODE version of the library, instead of CHR(0), you need to use the | symbol as delimiters.
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Makoto WATANABE »

Dear VANYA;

Thank you for letting me know.
I tried "|" and Chr(124) as the delimiter.
But with the same result.

The folder is not filtered, but I can select from all files, so there is no practical problem.

P.S.
Using the UNICODE version of libwindow9.a, Japanese text in Window Gadget is garbled, so I'm using the ASCII version of libwindow9.a.
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

Makoto WATANABE wrote: May 09, 2022 1:54 Dear VANYA;

Thank you for letting me know.
I tried "|" and Chr(124) as the delimiter.
But with the same result.

The folder is not filtered, but I can select from all files, so there is no practical problem.

P.S.
Using the UNICODE version of libwindow9.a, Japanese text in Window Gadget is garbled, so I'm using the ASCII version of libwindow9.a.
Perhaps you are doing something wrong. Perhaps they forgot to indicate in the window9.bi file or in the source file , that you are using the unicode version of the library. Here is an example, everything is displayed correctly on my Russian Windows system:

Code: Select all

#define unicode
#Include "window9.bi"

Dim As Integer event
OpenWindow("1",300,10,200,100)
ButtonGadget(1,10,10,150,30,"ダイアログを開く")

do  
	event=WaitEvent()
	If event=EventClose Then End
	If event=eventgadget Then 
		Var ddd = OpenFileRequester("英語のテキストファイルを指定する",_
		ExePath,"Text File(*.txt;*.csv;*.htm*)|*.txt;*.csv;*.htm*|All File(*.*)|*.*|")	
	EndIf
Loop
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Makoto WATANABE »

Dear VANYA;

Thank you very much for all your exact help in answering my rudimentary questions.

I forgot to write "#define unicode".
I was able to use the UNICODE version of libwindow9.a.
Window Gadget does not garble Japanese characters.
Extension filter is available in OpenFileRequester.
I can read and write Japanese files.
Thank you very much.

I have an additional question.

The following program does not give me the expected result when I specify a Japanese path.
Please tell me how to fix it.
Image

Code: Select all

#define unicode
#Include "window9.bi"

Dim As String ss

ss= "D:\freebasic\Win32_Macro.bas"
? GetExtensionPart(ss)

ss= "C:\Tool\iup_fb_editor32\Sample\80days.txt"
? GetExtensionPart(ss)

ss= "C:\Tool\iup_fb_editor32\サンプル\源氏物語.txt"
? GetExtensionPart(ss)
sleep
VANYA
Posts: 1834
Joined: Oct 24, 2010 15:16
Location: Ярославль
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by VANYA »

Hi Makoto WATANABE!

Your example with GetExtensionPart works correctly for me in both ASCII and UNICODE. Are you sure the file was saved in UTF16LE?

Try like this:

Code: Select all

#define unicode
#Include "window9.bi"

Dim As UString ss ' for UNICODE need USTRING

ss= "D:\freebasic\Win32_Macro.bas"
? GetExtensionPart(ss)

ss= "C:\Tool\iup_fb_editor32\Sample\80days.txt"
? GetExtensionPart(ss)

ss= "C:\Tool\iup_fb_editor32\サンプル\源氏物語.txt"
? GetExtensionPart(ss)
sleep
If it doesn’t work for you anyway, then here is the GetExtensionPart function itself:

Code: Select all

Function GetExtensionPart(ByRef sPath As USTRING) As USTRING Export
	dim as USTRING sRet
	Var Pos_=InStrRev(sPath,".")
	Var len_=Len(sPath)
	sRet = Right(sPath,Len_-Pos_)
	Return sRet
End Function
Put it at the beginning of the code after #Include "window9.bi"

And see where the problem is on your Japanese version of Windows.
Makoto WATANABE
Posts: 231
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: GUI library for Windows \ Linux (window9)

Post by Makoto WATANABE »

Dear VANYA;

I am sorry to have bothered you again.
The way to modify example programs for UNICODE version is clearly described in the help file !
*************
In the help, all examples are written for the STRING type.
For UNICODE versions of the library, simply replace STRING with USTRING in the examples.
*************
Thank you for solving my trouble immediately.
I appreciate your continuous support.
SARG
Posts: 1756
Joined: May 27, 2005 7:15
Location: FRANCE

Re: GUI library for Windows \ Linux (window9)

Post by SARG »

@RNBW
Small typo in help (EN), W is missing in title of ExpandTreeVieWItem page.
RNBW
Posts: 267
Joined: Apr 11, 2015 11:06
Location: UK

Re: GUI library for Windows \ Linux (window9)

Post by RNBW »

@SARG
Thank you for picking up the typo. It has been corrected.

Corrected file can be found at:
https://www.dropbox.com/s/twarsdvz7ezvn ... 9.chm?dl=0

@VANYA
Please note the correction and new file link.
RNBW
Posts: 267
Joined: Apr 11, 2015 11:06
Location: UK

Re: GUI library for Windows \ Linux (window9)

Post by RNBW »

@SARG
Thank you for picking up the typo. It has been corrected.

Corrected file can be found at:
https://www.dropbox.com/s/twarsdvz7ezvn ... 9.chm?dl=0

@VANYA
Please note the correction and new file link.
Post Reply