Page 1 of 1

Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 5:28 pm
by byron.hopp
Is there a trick to hide a checkbox on a dialog which I access through an RC file. I am making a calendar routine and wanted to hide all days outside of the current month, I can disable them so the user cannot check them, but I wanted to make them disappear. Thanks,

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 5:52 pm
by nageswaragunupudi
oChkBox:Hide()

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 6:02 pm
by byron.hopp
That was my first guess but this does not seem to work.

For dDay := dStart to dEnd
nEle++
nId++
lVar := FALSE
oChk := nil

If dDay >= dFrom .AND. dDay <= dTo
Redefine CheckBox oChk Var lVar Id nId of oDlg
oChk:SetText( PadL( Day(dDay),2,"0" ) )
oChk:cargo := dDay
oChk:SetCheck( FALSE )
Else
Redefine CheckBox oChk Var lVar Id nId of oDlg
oChk:Hide()
Endif
Next

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 6:13 pm
by byron.hopp
It appears that I need to perform this after the activate of the dialog. Works great. Thanks,

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 6:13 pm
by karinha
STATIC oChk ??

Regards.

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 6:19 pm
by byron.hopp
I hide them using the "ON INIT" when activating the dialog. Seemed to work well.

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 6:24 pm
by karinha
Maybe:

Code: Select all  Expand view

   REDEFINE CHECKBOX OCHK VAR LVAR ID NID OF ODLG // WHEN(.. )

   IF DDAY >= DFROM .AND. DDAY <= DTO

      ACTIVATE DIALOG ODLG CENTER // NORMAL

   ELSE

       ACTIVATE DIALOG ODLG CENTER ON INIT( OCHK:HIDE() )

   ENDIF
 


Regards, saludos.

Re: Hide a Checkbox from Resource.

PostPosted: Mon Jul 03, 2023 7:29 pm
by nageswaragunupudi
byron.hopp wrote:It appears that I need to perform this after the activate of the dialog. Works great. Thanks,

Yes.
We need to remember this always in case of all controls created on a dialog.