Silverfrost Forums

Welcome to our forums

Is it possible to make a smaller-than-usual button?

30 Nov 2008 5:44 #4051

I have been writing an application that has several buttons, edit boxes, and other things. It works fine, including the buttons.

The code for each button looks something like this:

C* Place button to Save Registers. i=winio@('%`ap&',dxpos1,dypos3) i=winio@('%^8bt[&Save]&',UPDATREG)

I know that if I change the %^8bt to %^6bt, the button will get shorter in its horizontal dimension.

My question is, is it possible to make a button which is smaller in both horizontal and vertical dimensions? I know how to make the text font smaller, but how about the button itself?

Thanx all!

30 Nov 2008 6:11 #4053

There must be more than one answer to this question, but probably the simplest is to use %tt instead of %bt.

You can also make custom buttons with %ib and &tb

However, if you shrink the font, don't the buttons shrink too?

Eddie

1 Dec 2008 4:28 #4055

Quoted from LitusSaxonicum There must be more than one answer to this question, but probably the simplest is to use %tt instead of %bt.

You can also make custom buttons with %ib and &tb

However, if you shrink the font, don't the buttons shrink too?

Eddie

Thank you, Eddie! %tt looks like the answer I wanted! Excellent!

Yes, when you shrink the font, the button shrinks too. But I was hoping to have standard or close-to-standard size text, and just less empty space around it between the text and the edge of the button.

1 Dec 2008 12:50 #4056

Here are two more ways....

  1. Use %di and design the dialog using a dialog editor or
  2. Use %lw to get the handle of the button then use %sc to initialise the window and call resize_window@ within the %sc callback to set the size of the button to exactly what you want.
1 Dec 2008 8:23 #4057

Paul,

Your method (2) is a really rather clever approach - but I keep forgetting that a control is also a window! As for your method (1), I've regarded the %di format code as forever beyond my ken (FTN95.chm doesn't help me much!).

Little-Acorn,

I have a program that operates with a single window (just like 'Calculator'). Unfortunately, this window is too large to fit when run on a PC with graphics resolution too low. So I call this routine at an early stage while setting up the window. Then all the buttons scale down, the window looks the same but it is smaller.

       SUBROUTINE SET_FONT_DETAILS
C      ---------------------------
C
C      This routine looks at screen vertical resolution and selects an
C      appropriate size for button fonts
C
C      -----------------------------------------------------------------
       DOUBLE PRECISION FACTOR
       INCLUDE <WINDOWS.INS>

       IX=GetSystemMetrics(SM_CXSCREEN)
       IY=GetSystemMetrics(SM_CYSCREEN)

       IF (IY .LT. 800) THEN
          FACTOR = 0.8D0
          IA=WINIO@('%fn[MS Sans Serif]%ts&',FACTOR)
          ENDIF

        RETURN
        END

I found it a better solution than %tt, and while %tt is the simplest solution, it isn't necessarily the best one.

Eddie

Please login to reply.