Subject Re: Can't change color of Check Box
From Akshat Kapoor <akshat.kapoor@kapoorsons.in>
Date Thu, 23 Mar 2017 23:13:31 +0530
Newsgroups dbase.getting-started

>> Perfect!  Many thanks, as usual.
>> Peter
> One more thing.  Is there a place at the beginning of my program that I can
> set systemTheme to false?  Or to set that as default throughout dBase.
>

I had also received this tip from Ken (if I remember correctly) when I
was unable to change colour of pushbutton , so Thank him.

As far as I know you have to set system theme to false for each control.
I think Ken / Mervyn will be able to tell if it can be set to false
through out dbase.

It is a pain in the ass to set system theme to false for each control on
the form. So I use custom controls.

class MUN_PUSH(parentObj) of PUSHBUTTON(parentObj) custom
    with (this)
       systemTheme = false
       height = 2.0
       left = 9.0
       top = 2.5
       width = 30.0
       text = "Pushbutton1"
       metric = 0        // Chars
       fontSize = 12.0
       colorNormal = "White/0xe5fd8"
       mousePointer = 13        // Hand
    endwith

endclass

This is code for custom pushbutton. I use this in all my forms.
I have developed custom controls for all the controls I normally use. It
is one time investment of time and the code is available till you do not
delete the .cc file

This enables uniformity of color codes across forms and moreover it is
easy to change color theme by changing at one place.

How to develop custom controls you will have to see the tutorials. I do
not remember exactly which tutorial / ken's book I learn't this trick.

The steps (brief overview) involved are
1. Create a form
2. Add a control to the form and set all the values that will be common
(you can alter the values in the inspector later on also)
3. Save this form (do not close it)
4. Click on the control to select it
5. In the file menu there is a save as custom option
6. Select the radio corresponding to selected component
7. Give a name to your class
8. Type/ Select a file name
9. Select the checkbox Place in component palette
10. Save

Open the .cc  file in editor
You will see a line
class MUN_PUSH2(parentObj, name) of PUSHBUTTON(parentObj, name) custom
change the above line to
class MUN_PUSH2(parentObj) of PUSHBUTTON(parentObj) custom
Save and close the .cc file

In the command window type set procedure to ??????.cc additive
Now when you open the component palette your control will be there under
the custom tab.

A .cc file can contain many custom controls. No need to have seprate
file for each control.

the .wfm file is no longer required But I will advise you not to delete
it because if some time later you want to make changes to a control the
.wfm will be required. If it is not there you will have to start from
scratch again.

Regards
Akshat