ButtonImage with Word Wrap

Just starting out? Need help? Post your questions and find answers here.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

ButtonImage with Word Wrap

Post by chris319 »

What's the easiest way to add word-wrapped text to a ButtonImage gadget?

Thank you.
User avatar
mk-soft
Always Here
Always Here
Posts: 5409
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: ButtonImage with Word Wrap

Post by mk-soft »

The best is to create a own gadget with CanvasGadget.

Help function for word-wrap: Link: DrawTextBox or DrawVectorTextBox
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: ButtonImage mit Word Wrap

Post by Saki »

If the gadget becomes narrower, line breaks are triggered,
which makes the text not fit into the gadget anymore, because it has more lines.
The word wrap functions of the OS, do not take this into account when calculating the text height.
DrawVectorParagraph() has word wrap included.
With custom word wrap functions you can count line breaks,
but this does not solve the problem of the resulting changes in text height.

It is simply that the text must fit into the gadget.
The simple solution is you try to use smaller text or fonts.
The better solution is to fit any text automatically into the gadget.

There are already these things ready, you just have to look for them a little bit.
There is just not much of it, because the programming is difficult.
地球上の平和
Post Reply