Page 1 of 1

iupScrollbox woes

Posted: 07 Sep 2023 08:14
by shoshk
Working on my data entry screen...

Sometimes, there are just a few fields:

And, sometimes, there are a lot:
image.png
image.png (55.73 KiB) Viewed 897 times

I generate the data entry screen dynamically on a basis of a definition file and I use iupScrollbox to manage scrollbars, in the event that there are more fields than can fit on the screen at one time.

So, my first problem...

iupScrollbox does not seem to add scrollbar properly. When it adds the vertical scrollbar, it causes a horizontal scrollbar to appear also; it seems that it's not taking the space occupied by the vertical scrollbar into account.

Is there a solution?

Thanks

Re: iupScrollbox woes

Posted: 07 Sep 2023 10:36
by tatewise
I have tried setting SCROLLBAR="VERTICAL" instead of the default "YES" but that makes no difference.

The only way I could eliminate the horizontal scrollbar was to force the SIZE of the dialogue to be wider.
e.g.

Code: Select all

   local strSize = dlg.SIZE
   local intWidth = tonumber( strSize:match( "^(%d+)x" ) ) + 30  -- Increase width by 30
   dlg.SIZE = strSize:gsub( "^%d+", tostring(intWidth) )  -- Make dialogue wider
   iup.Map(dlg)

Re: iupScrollbox woes

Posted: 07 Sep 2023 11:06
by shoshk
Where do you put this code? If I put it right after creating the dialog, it makes a narrow window.

Re: iupScrollbox woes

Posted: 07 Sep 2023 11:52
by tatewise
Put it after you have populated all the fields and the dialogue has been mapped.
e.g.

Code: Select all

  dlg:showxy(iup.CENTER, iup.CENTER)

   local strSize = dlg.SIZE
   local intWidth = tonumber( strSize:match( "^(%d+)x" ) ) + 30
   dlg.SIZE = strSize:gsub( "^%d+", tostring(intWidth) )
   iup.Map(dlg)