Silverfrost Forums

Welcome to our forums

Grey Controlling Using Radio Buttons

20 Oct 2004 7:50 #68

I was wondering if there was any sample code out there showing the usage of a radio button being used to not only specify a value, but also grey control for example, a %rs and %rd box? I am able to follow how some of the clearwin demo programs like 'filter' control the greying using %bt buttons, but not with actual radio buttons themselves.

21 Oct 2004 3:37 #71

You should look at the ^ and ~ modifier codes. From the help:

[quote] Four special characters, known as format modifiers, are often inserted after the size information and before the two-letter code. The first of these is the caret character (^) which indicates that a call-back function is supplied in the argument list (after any other arguments required by the format code). The tilde character (~) is used with certain format codes to control the disabling (greying) of the control. The grave accent character (`) is also used to modify the action of certain codes. These characters may only be used with the codes that define them as detailed in Format code reference. [/quote]

If you look at the help text for 'Button format':

[quote] Normally a button created with %bt is permanently enabled. However, if the tilde (~) format modifier is used then an extra INTEGER argument must be supplied (before any call-back function). This argument provides an integer that controls the state of the button. When this integer is zero the button is greyed and cannot be used. When this integer is 1 the button is enabled. Typically this control integer would be altered by code responding to another control. For example, after a successful file-opening, a number of options might be enabled. Note that there is no reason why the same control integer should not control several buttons and/or menu items.

For example:

    WINAPP
    INCLUDE <windows.ins>
    INTEGER grey_cntrl
    EXTERNAL open_f,save_f,save_as_f
    COMMON grey_cntrl
c---Only the OPEN button is initially available
    grey_cntrl=0
    i=winio@( '%^bt[Open]  &‘,open_f)
    i=winio@(‘%~^bt[Save]  &’,grey_cntrl,save_f)
    i=winio@(‘%~^bt[Save as]',grey_cntrl,save_as_f)
    END
c---
    INTEGER function open_f()
     INTEGER grey_cntrl
     COMMON grey_cntrl
     grey_cntrl=1
     open_f=2
    END
    .....

[/quote]

The example enables and disables buttons but you use the example on edit boxes


Administrator Silverfrost Forums


-- Admin Silverfrost Limited
Please login to reply.