Subject Re: getColor
From Mervyn Bick <invalid@invalid.invalid>
Date Tue, 23 Feb 2021 13:56:28 +0200
Newsgroups dbase.getting-started

On 2021/02/22 22:02, Peter Hegelbach wrote:
> Hi all
>
>  From OLH: Sample getColor:
>
> function backgroundColorButton_onClick
>     private rgbValue // Use private for &macro
>     rgbValue = getcolor()
>     if rgbValue # ""
>        form.colorscheme1.rowset.fields[ "BACKGROUND" ].value = rgbValue
>        define color SAMPLE_BG &rgbValue
>        form.sampleBackground.colorNormal = "SAMPLE_BG"
>     endif

Ken has explained why this doesn't work.  The documentation needs to be
updated so that programmers don't get caught by this.

A better way of doing this is to use the empty() function.

     if empty(rgbValue)
         .....
     endif

Mervyn.