Silverfrost Forums

Welcome to our forums

User-defined %tt button widths?

17 Mar 2014 5:50 #13859

I have a vertical stack of buttons, currently coded with %bt which allows me to set them all the same width. However %bt makes for a bulky button and a high stack. %tt would be much neater, but I can't control the width, which seems to be set automatically depending on the text width. Is there any way to control the width of a %tt button? The only solution I can think of is to define all the text strings the same length with a '.' at the start and end of the string, such as

     .     scaling      .
     .  annotation     .
     .       exit       .  

but this looks messy and involves extra coding to centre the text on the button. Maybe I should be using %ib instead, but then I would need to supply a bitmap resource which I really don't need for any other reason, and it would make the program a bit more complicated. Would be nice if %tt could simply take an optional width like %bt

17 Mar 2014 10:55 #13860

You've also got %bb that can be sized and doesn't always need an icon - and it is lower height than %bt. If room is really limited, you can use a %ls list box instead of a stack of buttons.

The %tt appears to have been designed with horizontal toolbars in mind (e.g. the tt means 'textual toolbar'), in which case minimising vertical height, and having a restricted range of widths seem to be sensible design choices (originally). When using %tt in a horizontal row you also can't easily get small gaps between the buttons.

You may find that a fixed number of characters doesn't always work perfectly because the characters are not fixed width.

I agree that the differences in the sizing mechanism can be frustrating, and for this reason I abandoned vertical stacks of buttons in my own code some years ago.

Eddie

18 Mar 2014 7:35 #13861

It might be worth looking at %dy as well as %bb. %dy provides vertical height adjustment between controls (i.e. buttons in this case).

18 Mar 2014 9:12 #13863

Many thanks, each. I shall try these suggestions. Not so sure about the %ls to create the stack - although I'm using %ls elsewhere in the program to select different actions, it's not really appropriate here.


update 18/3 11:45 -- tried %bb and it's just the ticket! I have to remember that anything I can't find in the CHM file could well be in cwplus.enh -- in fact it seems there's so much there that the CHM file is long overdue for an update!

18 Mar 2014 2:19 #13864

There are a lot of possibilities with %bb, and there is a thread on it somewhere in the forum.

In particular, there are a couple of possibilities with the treatment of the icon (if you use one) when the button is greyed out. The mechanism to grey the icon turns it into a blob if you have crafted it carefully with antialiasing, and I use the variant where the button text greys but the icon doesn't [// between icon name and text, not just one /].

I am a big fan of cwplus.enh and recommend it to all and sundry, but in the case of %bb it is of little use - the requisite information is elsewhere in the Forum!

I am a big believer in reading documentation before asking for help, and agree that FTN95.CHM could well do with some work on it - or I have to change my behaviour to ask first and look for myself second!

Eddie

Please login to reply.