* iuplabel and wordwrap

For plugin authors to discuss plugin programming
Post Reply
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

iuplabel and wordwrap

Post by jelv »

Has anyone succeeded in getting iuplabel with wordwrap on to automatically expand vertically depending on the length of the title text? It is inside an hbox with a fixed width. The title is being set when the label is created. I've tried expand = 'VERTICAL'.

Ive also tried flatlabel with textwrap.
John Elvin
avatar
jelv
Megastar
Posts: 649
Joined: 03 Feb 2020 22:57
Family Historian: V7
Location: Mere, Wiltshire

Re: iuplabel and wordwrap

Post by jelv »

Well I've achieved the affect I wanted but it's one heck of a kludge!

Basically:
  • dialogName:map()
  • get the SIZE attribute of the label, if it's width is more than will fit (maxwidth) set the size of the label to 'maxwidthx16' for two lines or 'maxwidthx24' for three lines
  • iup.SetAttribute(dialogName, 'SIZE', '')
  • iup.Refresh(dialogName)
  • dialogName:popup
It also needed some tweeks to the rest of the dialog to stop them going too wide before the adjustment.
John Elvin
Post Reply