Page 1 of 1

inputbox width

Posted: Sunday 5th December 2021 10:16am
by bill-lancaster
Is it just me? inputbox is now shown as quite narrow in width.
For example:-

Code: Select all

InputBox("Enter description", "Document description", sVar)
looks like the attached image where the prompt is just "Enter". Also the width of the box is partly affected by the length of the promt.
Any ideas?

Gambas 3.16.3
Kubuntu 20.04

Re: inputbox width

Posted: Sunday 5th December 2021 1:34pm
by cogier
Hi Bill, only me!

I noticed that the help file says the Prompt is rich text.

Image

So if you change the Prompt as below: -
InputBox("<h1> Enter description </h1>", "Document description", sVar)
You get: -
Image

If this is not wide enough, my tests showed you could use 29 characters while using Header 1 (<h1>)

Re: inputbox width

Posted: Sunday 5th December 2021 4:10pm
by BruceSteers
This is the code from the InputBox class...

  panBox.W = Max(Desktop.Scale * 48, lblMessage.W)


Desktop.Scale is the standard desktop font width so it's limited to 48 normal chars wide otherwise the message text box is set by the text message width.

Re: inputbox width

Posted: Sunday 5th December 2021 5:56pm
by bill-lancaster
Thanks Cogier, hadn't thought to check the help pages!
Now:-

Code: Select all

InputBox("<h1>Enter Year<h1>", "Year of the document date")
looks like:-

Re: inputbox width

Posted: Monday 6th December 2021 2:46am
by BruceSteers
If you want control Bill InputBox is really easy to import into your program.

Just copy files InputBox.class / FInputBox.class / FInputBox.form into your .src folder from the gambas source in /comp/gb.form/.src
Then rename InputBox.Class to MyInputBox.class (or something)

then you can edit the FInputBox.class file to make the window bigger

InputBox code looks kinda iffy to me.

Try this one...
I've made the InputBoxW.class take another MinWidth arg to set a min width if required
plus made it convert "\n" to "<br>"
plus made the window resize a bit differently...

Re: inputbox width

Posted: Monday 6th December 2021 8:56am
by bill-lancaster
The problem occurs with QT4/5.
With GTK inputbox works properly - the width of the textbox seems to be set by the with of text as Bruce points out.
Will give inputboxw a try

Re: inputbox width

Posted: Monday 6th December 2021 3:43pm
by grayghost4
I have found there are other differances between QT and GTK, screen display is just one another is printing, one uses 72 dpi the other uses 300 dpi.
I guess it depends on the distro and desktop you use which is best for you.
Since I use Ubuntu and Gnome, GTK is best for me.

There are just too many choices to make in this world :D