AppBasic and the Toolbox Writable Field gadget
Richard Ashbery (495) 163 posts |
The Toolbox Writable Field gadget doesn’t have provision for setting its window to another colour. Ideally I need to be able to set its icon colour to grey from the handler code. The Writable icon from the Templates Icon picker allowed the programmer to set the icon colour by using a Validation string which I know some of you guys are not keen on. Is there a simple work-around? |
Colin (478) 2433 posts |
If you mean you want to fade the writable field use gadget_set_flags and set the Gadget_Faded flag (bit 31) |
Steve Drain (222) 1620 posts |
The Toolbox is Style Guide compliant. Writable fields are white, therefore the TB does not allow you to change that. If you want to write applications that are not SG-compliant you will have to abandon the TB. ;-) The question remains: why do you want to do this? The answer may suggest a way forward. |
Chris Johnson (125) 825 posts |
One way of doing your own thing in the toolbox is to use the ‘Button’ gadget. This would allow you to change most things via validation strings etc. You would have to write a lot more code, of course. |
Richard Ashbery (495) 163 posts |
I have a simple maths program that apart from doing simple addition, subtraction, multiplication and division will do square and square root functions. It uses two Writable gadgets for user input (first four functions). Only one Writable gadget is required for the last two functions and to stop input being typed into the second Writable gadget I need some form of inhibit. Of course greying out the gadget by itself won’t do this. I thought I was being very clever using an unorthodox work-around. It involves effectively deleting the gadget when square and square root arithmetic is performed and then re-instating it when the other four functions are used. Measure the size of the gadget with PROCGadget_GETBBox(object,component,x,y,X,Y) then use MoveGadget option making x=X and y=Y. It’s a fiddle which appears to work but a number and cursor are still visible even though the gadget has disappeared. Not to be recommended :-( |
Richard Ashbery (495) 163 posts |
Colin – you are absolutely correct – that is exactly what I need to do – sorry for the confusion. |
Steve Drain (222) 1620 posts |
I think fading the gadget is exactly what you want, as Colin suggested. You cannot write in a faded WritableField. I have used this for quite similar purposes. |