Correct use of DC_GETOPTDEFAULT

This forum is for eXpress++ general support.
Post Reply
Message
Author
User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Correct use of DC_GETOPTDEFAULT

#1 Post 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) }
Last edited by GeneB on Mon Jul 21, 2014 9:17 am, edited 1 time in total.

User avatar
Tom
Posts: 1206
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Correct use of DC_GETOPTDEFAULT

#2 Post 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.
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
rdonnay
Site Admin
Posts: 4777
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#3 Post by rdonnay »

Gene -

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

Roger
The eXpress train is coming - and it has more cars.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#4 Post 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?

User avatar
Tom
Posts: 1206
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Correct use of DC_GETOPTDEFAULT

#5 Post 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()?
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#6 Post 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


User avatar
Tom
Posts: 1206
Joined: Thu Jan 28, 2010 12:59 am
Location: Berlin, Germany

Re: Correct use of DC_GETOPTDEFAULT

#7 Post by Tom »

Initialize GetOptions to an empty array wherever used:

Code: Select all

LOCAL GetOptions := {}
Best regards,
Tom

"Did I offend you?"
"No."
"Okay, give me a second chance."

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#8 Post by GeneB »

Of course.
However, making that change in test.prg doesn't change the outcome.

User avatar
GeneB
Posts: 158
Joined: Sun Jan 31, 2010 8:32 am
Location: Albuquerque, New Mexico, USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#9 Post 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.

Cliff Wiernik
Posts: 605
Joined: Thu Jan 28, 2010 9:11 pm
Location: Steven Point, Wisconsin USA
Contact:

Re: Correct use of DC_GETOPTDEFAULT

#10 Post 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.

Post Reply