Howto wordwrap in XML dialogue text gadget?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Howto wordwrap in XML dialogue text gadget?

Post by Kukulkan »

Hello,

I like to add some explaining text in an XML dialogue like this:

Code: Select all

<text name='txtInfo' text='This is to help you setting up your e-mail account settings. Please enter your e-mail address and password. Now click on -Check- to detect your mailserver settings.' />
<button name='btnCheck' text='Check'  />
<hbox>
  <button name='btnCancel' text='Cancel' />
  <button name='btnOK' text='OK'/>
</hbox>
Obviously, txtInfo contains a very long text and the dialogue is getting way to wide trying to do all in one line. I tried to insert linebreaks but this seems not possible. Best would be to have the field hitting a maximum width and then do wordwrap. The height has to automatically fit so that the following elements are in good position.

How to do?

Kukulkan
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Howto wordwrap in XML dialogue text gadget?

Post by Fred »

You can put your own tag in it, and then use Get/SetGadgetText(). I don't know if it will be properly resized tough.
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Howto wordwrap in XML dialogue text gadget?

Post by Kukulkan »

Hi Fred,

There is no gadget-type available to simply display multiline text with wordwrap? I thought I only missed something. :|

But it will not auto-fit the sizes, right? It seems to respect linebreaks by using SetGadgetText(), but no auto-size and I need to know all sizes before to use width and height. But my text is multi-language and will change in size. And users may have different DPI settings so my pixel height and width will fail for this field, too.

How to solve?

Kukulkan
User avatar
Kukulkan
Addict
Addict
Posts: 1396
Joined: Mon Jun 06, 2005 2:35 pm
Location: germany
Contact:

Re: Howto wordwrap in XML dialogue text gadget?

Post by Kukulkan »

I just found out that using &#xA; as a linebreak in XML seems to work (at least on Windows, did not test on others yet). In such case the size seems to be automatically chosen. But no wordwrap at all. Not very satisfying as my translator is now responsive for the layout...

Kukulkan
Little John
Addict
Addict
Posts: 4777
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: Howto wordwrap in XML dialogue text gadget?

Post by Little John »

Kukulkan wrote:But no wordwrap at all. Not very satisfying as my translator is now responsive for the layout...
Hi,

unfortunately, I don't have any additional information about the behaviour of PB's XML dialogs.
But when your program has to do word wrap itself, then some code in this thread might be helpful.
Post Reply