inputbox width

Post your Gambas programming questions here.
Post Reply
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

inputbox width

Post 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
Attachments
inputbox.png
inputbox.png (12.92 KiB) Viewed 3083 times
User avatar
cogier
Site Admin
Posts: 1118
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: inputbox width

Post 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>)
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: inputbox width

Post 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.
If at first you don't succeed , try doing something differently.
BruceS
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: inputbox width

Post 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:-
Attachments
inputbox2.png
inputbox2.png (21.72 KiB) Viewed 3051 times
User avatar
BruceSteers
Posts: 1523
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: inputbox width

Post 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...
If at first you don't succeed , try doing something differently.
BruceS
bill-lancaster
Posts: 190
Joined: Tuesday 26th September 2017 3:17pm
Location: NW England

Re: inputbox width

Post 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
User avatar
grayghost4
Posts: 174
Joined: Wednesday 5th December 2018 5:00am
Location: Marengo, Illinois usa

Re: inputbox width

Post 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
Post Reply