TinyDialog a simple Windows and Linux user interface.
Re: TinyDialog a simple Windows and Linux user interface.
Thanks for this nice program!
I found a problem: dlg.GetString returns an empty string when the input is one ore more pipes (|). Joshy, could you please fix this? Thanks!
I found a problem: dlg.GetString returns an empty string when the input is one ore more pipes (|). Joshy, could you please fix this? Thanks!
Re 'Segmentation fault'
Just installed Valgrind debugger on Puppy Wary 5.5; Speed tests of "Test01" example + others.
Also getted 'Segmentation fault'.
Via ldd & Valgrind & GFX window I see that Tinydialog.so is not seen/linked, even in "usr/lib" ??
Looks like configuration problem of gcc, fbc.
I can only advice - Check your visibility of that & paths; eventually compile on another distro which works correctly and '/usr/lib' path is setted as default for compiler.
Also getted 'Segmentation fault'.
Via ldd & Valgrind & GFX window I see that Tinydialog.so is not seen/linked, even in "usr/lib" ??
Looks like configuration problem of gcc, fbc.
I can only advice - Check your visibility of that & paths; eventually compile on another distro which works correctly and '/usr/lib' path is setted as default for compiler.
Segfaults error Answered
Today installed Valgrind 381 on Slacko puppy 56.
As you can see in image, here is Tinydialog.so library accepted from LOCAL directory along app exe file TEST01.
So really things depends on distro and default configuration of compilers.
As you can see in image, here is Tinydialog.so library accepted from LOCAL directory along app exe file TEST01.
So really things depends on distro and default configuration of compilers.
-
- Posts: 436
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: TinyDialog a simple Windows and Linux user interface.
When I click with the right mouse button on the fbgfx screen, I do not see anything (WIndows 8).D.J.Peters wrote:If you use a fbgfx screen you can show any dialog via the right mouse button.
Code: Select all
#include once "TinyDialog.bi"
ScreenRes 640, 480, 32
GetKey
Re: TinyDialog a simple Windows and Linux user interface.
You just need to use the correct functions: http://www.freebasic.net/wiki/wikka.php ... PgGfxInput
-
- Posts: 436
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: TinyDialog a simple Windows and Linux user interface.
I do not understand, what do you mean? Do I have to evaluate the right mouse button via 'Getmouse' in my code? Could you please give me an example?
Re: TinyDialog a simple Windows and Linux user interface.
Lothar Schirm wrote:I do not understand, what do you mean? Do I have to evaluate the right mouse button via 'Getmouse' in my code? Could you please give me an example?
Code: Select all
#include "fbgfx.bi"
screenres 640,480,32
dim as integer mx, my, mb
while not multikey(fb.SC_ESCAPE) ' push esc to exit
cls
getmouse mx, my, ,mb
locate 1,1
print using "X: &, Y: &, Buttons: &"; mx; my; mb
sleep 50,1
wend
-
- Posts: 436
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: TinyDialog a simple Windows and Linux user interface.
sir_mud,
may be I have misunderstood what D.J.Peters wrote. I have compiled your example into the folder whih contains TinyDialog.dll and libTinyDialog.dll.a. When I run your example, it displays a black graphics window and displays the mouse position and the pressed button. But I have expected if I press the right mouse button that I could select a dialog from a popup menu or something similiar. What is the purpose of your code?
may be I have misunderstood what D.J.Peters wrote. I have compiled your example into the folder whih contains TinyDialog.dll and libTinyDialog.dll.a. When I run your example, it displays a black graphics window and displays the mouse position and the pressed button. But I have expected if I press the right mouse button that I could select a dialog from a popup menu or something similiar. What is the purpose of your code?
Re: TinyDialog a simple Windows and Linux user interface.
Simply to help you understand the getmouse function.Lothar Schirm wrote:sir_mud,
may be I have misunderstood what D.J.Peters wrote. I have compiled your example into the folder whih contains TinyDialog.dll and libTinyDialog.dll.a. When I run your example, it displays a black graphics window and displays the mouse position and the pressed button. But I have expected if I press the right mouse button that I could select a dialog from a popup menu or something similiar. What is the purpose of your code?
-
- Posts: 436
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: TinyDialog a simple Windows and Linux user interface.
Thank you, but it is no problem for me to understand how 'GetMouse' works. Who can explain me what D.J. Peters means: "If you use a fbgfx screen you can show any dialog via the right mouse button"?
Re: TinyDialog a simple Windows and Linux user interface.
using the example from the first post I come up with:Lothar Schirm wrote:Thank you, but it is no problem for me to understand how 'GetMouse' works. Who can explain me what D.J. Peters means: "If you use a fbgfx screen you can show any dialog via the right mouse button"?
Code: Select all
#include once "TinyDialog.bi"
dim as TinyDialog dlg
dlg.addSeperator ["label text"]
id = dlg.addBoolean(["label text"],[0/1],["true text","false text"],["tooltip text"])
id = dlg.addInteger(["label text"],[iValue],["tooltip text"])
id = dlg.addIntegerMin(["label text"],[iValue],iMin,["tooltip text"])
id = dlg.addIntegerMinMax(["label text"],[iValue],iMin,iMax,["tooltip text"])
id = dlg.addIntegerMinMaxStep(["label text"],[iValue],iMin,iMax,iStep,["tooltip text"])
id = dlg.addReal(["label text"],[rValue],["tooltip text"])
id = dlg.addRealMin(["label text"],[rValue],rMin,["tooltip text"])
id = dlg.addRealMinMax(["label text"],[rValue],rMin,rMax,["tooltip text"])
id = dlg.addRealMinMaxStep(["label text"],[rValue],rMin,rMax,rStep,["tooltip text"])
id = dlg.addAngle(["label text"],[rValue],["tooltip text"])
id = dlg.addAngleMin(["label text"],[rValue],rMin,["tooltip text"])
id = dlg.addAngleMinMax(["label text"],[rValue],rMin,rMax,["tooltip text"])
id = dlg.addAngleMinMaxStep(["label text"],[rValue],rMin,rMax,rStep,["tooltip text"])
id = dlg.addString(["label text"],["text"],["tooltip text"])
id = dlg.addMultiLine(["label text"],["text"],["tooltip text"])
id = dlg.addOptions(["label text"],["item1|item2|..."],[selected],["tooltip text"])
id = dlg.addList(["label text"],["item1|item2|..."],[selected],["tooltip text"])
id = dlg.addLoadButton(["label text"],["filename"],["filter"],["start folder"],[iChangedir],[iOverwrite],["tooltip text"])
id = dlg.addSaveButton(["label text"],["filename"],["filter"],["start folder"],[iChangedir],[iOverwrite],["tooltip text"])
id = dlg.addDirButton(["label text"],["pathname"],["start folder"],[iChangedir],[iOverwrite],["tooltip text"])
id = dlg.addColorButton(["label text"],[uiColor],["tooltip text"])
id = dlg.addFontButton(["label text"],[FontName],["tooltip text"])
dlg.Title = "don't look at the bi file ;-)"
dlg.SetOKButtonText("txt")
dlg.SetCancelButtonText("txt")
while 1
cls
dim as integer mx, my, mb
getmouse mx, my, , mb
print using "X: &; Y: &; Buttons: &;"; mx; my; mb
if mb and 2 then
var result = dlg.Show()
end if
wend
-
- Posts: 436
- Joined: Sep 28, 2013 15:08
- Location: Germany
Re: TinyDialog a simple Windows and Linux user interface.
Thank you, sir_mud. But if I run your code, a get a lot of compiler error messages:
C:\FreeBASIC\TinyDialog\FBTEMP.bas(4) error 18: Element not defined, addSeperator in 'dlg.addSeperator ["label text"]'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(4) error 3: Expected End-of-Line, found '[' in 'dlg.addSeperator ["label text"]'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(6) error 41: Variable not declared, id in 'id = dlg.addBoolean(["label text"],[0/1],["true text","false text"],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(8) error 7: Expected ')', found '[' in 'id = dlg.addInteger(["label text"],[iValue],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(9) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMin(["label text"],[iValue],iMin,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(10) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMinMax(["label text"],[iValue],iMin,iMax,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(11) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMinMaxStep(["label text"],[iValue],iMin,iMax,iStep,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(13) error 7: Expected ')', found '[' in 'id = dlg.addReal(["label text"],[rValue],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(14) error 1: Argument count mismatch, found '[' in 'id = dlg.addRealMin(["label text"],[rValue],rMin,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(15) error 1: Argument count mismatch, found '[' in 'id = dlg.addRealMinMax(["label text"],[rValue],rMin,rMax,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(15) error 125: Too many errors, exiting
What is wrong?
Edit:
Ok, I was a bit confused, but I think I understand what you mean. The example seems to be rather a syntax definition (with example parameters) than a FreeBASIC code, so I have to write the code accordingly and then start the program.
C:\FreeBASIC\TinyDialog\FBTEMP.bas(4) error 18: Element not defined, addSeperator in 'dlg.addSeperator ["label text"]'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(4) error 3: Expected End-of-Line, found '[' in 'dlg.addSeperator ["label text"]'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(6) error 41: Variable not declared, id in 'id = dlg.addBoolean(["label text"],[0/1],["true text","false text"],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(8) error 7: Expected ')', found '[' in 'id = dlg.addInteger(["label text"],[iValue],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(9) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMin(["label text"],[iValue],iMin,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(10) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMinMax(["label text"],[iValue],iMin,iMax,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(11) error 1: Argument count mismatch, found '[' in 'id = dlg.addIntegerMinMaxStep(["label text"],[iValue],iMin,iMax,iStep,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(13) error 7: Expected ')', found '[' in 'id = dlg.addReal(["label text"],[rValue],["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(14) error 1: Argument count mismatch, found '[' in 'id = dlg.addRealMin(["label text"],[rValue],rMin,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(15) error 1: Argument count mismatch, found '[' in 'id = dlg.addRealMinMax(["label text"],[rValue],rMin,rMax,["tooltip text"])'
C:\FreeBASIC\TinyDialog\FBTEMP.bas(15) error 125: Too many errors, exiting
What is wrong?
Edit:
Ok, I was a bit confused, but I think I understand what you mean. The example seems to be rather a syntax definition (with example parameters) than a FreeBASIC code, so I have to write the code accordingly and then start the program.
Re: TinyDialog a simple Windows and Linux user interface.
Hi all,
I'm trying to use TinyDialog.dll on Win(8.1/64) in the following way:
Inside another DLL there's just 1 Function 'Configuration' that needs/has access to 'Tiny'
everything else runs without any screen interaction.
Therefore I want to load the DLL with DyLibLoad/DyLibFree from within 'Configuration' only.
Including TinyDialog.bi (slightly modified) gives me unexpected compiler errors.
Modifications in .BI are as follows:
What I don't get (understand) is the compiler error 52 above, because IT IS INSIDE of a Constructor!
The second one is probably just a related issue (not of its own).
Can anybody plse. explain?
I'm trying to use TinyDialog.dll on Win(8.1/64) in the following way:
Inside another DLL there's just 1 Function 'Configuration' that needs/has access to 'Tiny'
everything else runs without any screen interaction.
Therefore I want to load the DLL with DyLibLoad/DyLibFree from within 'Configuration' only.
Including TinyDialog.bi (slightly modified) gives me unexpected compiler errors.
Modifications in .BI are as follows:
Code: Select all
' TinyDialog.bi
#ifndef __TINYDIALOG_BI__
#define __TINYDIALOG_BI__
#Include "c:\FreeBASIC\inc\crt.bi" MODIFICATION full path necessary to avoid 'not found ...' compile error
#ifdef __FB_LINUX__
type ShowDialog_t as function(title as zstring ptr,Items as zstring ptr, nItems as integer,nSeperators as integer,pParams as any ptr) as integer
#else
declare function ShowDialog(title as zstring ptr,Items as zstring ptr, nItems as integer,nSeperators as integer,pParams as any ptr) as integer
'#inclib "c:\FreeBASIC\lib\TinyDialog" MODIFICATION commented out
#endif
type TinyDialog
...
...
private:
...
...
#Ifdef __FB_LINUX__
As ShowDialog_t ShowDialog
as any ptr hLib
#Else MODIFICATION new, added
as any ptr hLib
#endif
end type
constructor TinyDialog (sTitle as string)
strTitle = trim(sTitle)
if len(strTitle)=0 then strTitle="tiny dialog"
strOk="OK":strCancel="Cancel"
#Ifdef __FB_LINUX__
hLib = DylibLoad("TinyDialog.so")
if hLib then
ShowDialog = DylibSymbol(hLib,"SHOWDIALOG")
if ShowDialog = 0 then
? "error: can't locate 'ShowDialog()' in 'TinyDialog.so' !"
end if
else
? "error: can't load 'TinyDialog.so' !"
EndIf
#Else MODIFICATION new, added #Else Block
hLib = DylibLoad("TinyDialog.dll")
if hLib then
ShowDialog = DylibSymbol(hLib,"SHOWDIALOG") 'error 52: Illegal outside a CONSTRUCTOR, DESTRUCTOR, FUNCTION, OPERATOR, PROPERTY or SUB block
if ShowDialog = 0 then 'error 1: Argument count mismatch, found '=' in 'if ShowDialog = 0 then'
? "error: can't locate 'ShowDialog()' in 'TinyDialog.dll' !"
end if
else
? "error: can't load 'TinyDialog.dll' !"
EndIf
#EndIf
End constructor
destructor TinyDialog
this.Clear
'#ifdef __FB_LINUX__ MODIFICATION commented out
if hLib then DylibFree(hLib)
'#endif MODIFICATION commented out
end destructor
What I don't get (understand) is the compiler error 52 above, because IT IS INSIDE of a Constructor!
The second one is probably just a related issue (not of its own).
Can anybody plse. explain?
Re: TinyDialog a simple Windows and Linux user interface.
Code: Select all
...
ShowDialog = DylibSymbol(hLib,"SHOWDIALOG")
if ShowDialog = 0 then
...
You'd like to compare the function pointer
Code: Select all
...
IF @ShowDialog = 0 THEN
...
Re: TinyDialog a simple Windows and Linux user interface.
Thanks TJF, but the first issue is the first ERROR 52 (see below).
The ERROR 1 could just be a result of the first ... .
I'd like to sort out the MAIN-Question about ERROR 52 first, before looking into anything else.TJF wrote:This compares the returned value from the function ShowDialog() with 0 (zero) - the function call is without parameters, therefor the error message.Code: Select all
... ShowDialog = DylibSymbol(hLib,"SHOWDIALOG") ' compiler error 52: (see my first post for details), seems to work on Linux! if ShowDialog = 0 then 'compiler error 1: (see my first post for details),also seems to work on Linux ...
You'd like to compare the function pointer
Code: Select all
... IF @ShowDialog = 0 THEN ...
The ERROR 1 could just be a result of the first ... .