Page 1 of 1

Correct use of DC_GETOPTDEFAULT

Posted: Fri Jul 18, 2014 9:14 pm
by GeneB
I'm trying to remove all min/max buttons.
If I use just DC_GetOptDefaults() or use an OPTIONS CLAUSE in DCREAD they are removed in a window.
If I use NOMINBUTTON and NOMAXBUTTON in DC_GetOptDefaults() and also use an OPTIONS clause in the DCREAD they are not removed.
What is the correct way to use DC_GetOptDefaults() ?

// This does not remove min/max buttons:

DCGETOPTIONS ;
NOMINBUTTON ;
NOMAXBUTTON
DC_GETOPTDEFAULT(GetOptions)

DCGETOPTIONS ;
NOBUSYPOINTER ;
AUTORESIZE

DCREAD GUI FIT ;
APPWINDOW @oDialog ;
OPTIONS GetOptions ;
EVAL {|o| SetAppWindow(o) }

Re: Correct use of DC_GETOPTDEFAULT

Posted: Sun Jul 20, 2014 11:54 pm
by Tom
Hi, Gene.

Mostly correct.

Code: Select all

FUNCTION SetDefOptions()
LOCAL GetOptions := {}

DCGET OPTIONS ...

DC_GetOptDefault(GetOptions)
RETURN NIL
If I set NOMIN-/NOMAXBUTTON there (at app start), no dialog has min- or maxbuttons anymore, even if they have own DCGET OPTIONS.

Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 7:55 am
by rdonnay
Gene -

Unfortunately, the NOMINBUTTON and NOMAXBUTTON clauses do not work on non-modal windows.
This is a limitation of Windows.

Roger

Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 9:15 am
by GeneB
Thank you both. That explains why it wouldn't work. Few of my windows are modal.
I found that I can use Tom's SetDefOptions() just prior to DCREAD GUI in each window and it works for that window.
Was tedious to change every DCREAD, but now inside SetDefOptions I have a system side user selectable option of whether to show min/max or not.

When my users would minimize a window, there was no visible toolbar to offer maximize left in the app window. They had to exit the blank app window with 'Escape' and reselect the window for the toolbar to be visible.
Any way to make the toolbar visible immediately after minimize is selected?

Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 9:24 am
by Tom
Hi, Gene.
I found that I can use Tom's SetDefOptions() just prior to DCREAD GUI in each window and it works for that window.
It should work for every window created after that. There must be something else inside your app preventing this system from working. Do you use DC_AutoRestoreWindow()?

Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 12:49 pm
by GeneB
Yes, I am using DC_AutoRestoreWindow()
But...
In the test program below, if I set the system defaults the min/max buttons are hidden.
But if I then add an OPTIONS to the DCREAD, the min/max buttons are not hidden.
This is the case whether the window is modal or not.

Code: Select all


#include  "dcdialog.ch"

FUNCTION Main()
local cAcct:=SPACE(4), GetOptions, getlist:={}

SetDefaultOptions()

@ 1,1 DCSAY "Acct" GET cAcct   ;
         PICTURE "!!!!"        ;
         SAYSIZE 8 GETSIZE 7

@ 3,1 DCSAY "Type" SAYSIZE 50

//DCGETOPTIONS AUTORESIZE
DCREAD GUI FIT ADDBUTTONS ;
//   OPTIONS GetOptions

RETURN NIL


PROC AppSys() ; return


FUNCTION SetDefaultOptions()
local GetOptions

DCGETOPTIONS NOMINBUTTON NOMAXBUTTON
DC_GetOptDefault(GetOptions)

RETURN NIL


Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 1:47 pm
by Tom
Initialize GetOptions to an empty array wherever used:

Code: Select all

LOCAL GetOptions := {}

Re: Correct use of DC_GETOPTDEFAULT

Posted: Mon Jul 21, 2014 4:17 pm
by GeneB
Of course.
However, making that change in test.prg doesn't change the outcome.

Re: Correct use of DC_GETOPTDEFAULT

Posted: Tue Jul 22, 2014 6:45 am
by GeneB
It appears that nominbutton and nomaxbutton are the only defaults that won't hold their values in the above example.
I have set their value with a user function for each call of DCREAD, which allows the user to select the buttons or to hide the buttons, so I'll stay with that unless something easier comes along.
Thanks for the help.

Re: Correct use of DC_GETOPTDEFAULT

Posted: Tue Jul 22, 2014 10:20 am
by Cliff Wiernik
We disable the maximize button in our application via the EVAL clause of DCREAD. It makes calls to windows functions. You can also do for the minimize button. It might be something like Tom's function does.