Page 1 of 1

How to prevent open child window only once

Posted: Wed Feb 18, 2015 3:03 am
by Victorio
I have main menu, DCSUMBENU... DCMENUITEM ..... ACTION call other dialog window
How I prevent to click to main MENU and prevent to open other dialog windows twice, 3,4,... times ?

I saw some command in one sample or manual what by I cannot found where :oops:

I want make, then if I click on MENU, select some function that open next dialog window, than must close this dialog when want select other one.

Maybe it is SetAppFocus(), ?

My source code is in my other post DCBROWSE refresh.

Also I have question, how sizing and positioning Aplication window size, size of dialogs, for universal torun on user PCs with differently screen resolutions ? Maybe on have resolution 640/480, anyone 1280/1024,... etc.
I count size from SetAppWindow():currentsize(), then set main app windows to size for example 0,9x currentsize ,
ane other dialog windows ? in PIXEL size or ROW, COL ? what is better, If i count their size in 0,xx of current size, I can fill better screen, if in row,col, user with hgh resolution have small dialog windows.
Need too count font size ? to best "visual design" of aplication ?
Sizing in relative row, col is easier ;)



thanks...

Re: How to prevent open child window only once

Posted: Wed Feb 18, 2015 6:29 am
by Wolfgang Ciriack
I want make, then if I click on MENU, select some function that open next dialog window, than must close this dialog when want select other one.
Make the dialog you call modal:

Code: Select all

DCREAD GUI TITLE "Mywin" MODAL SETAPPWINDOW FIT.....
For automatic recising dialogs look at the example exp\Samples\Resize\restest.exe and choose
DCGUI_RESIZE_AUTORESIZE_SCALEFONT and click the button "Test Rule".

Re: How to prevent open child window only once

Posted: Wed Feb 18, 2015 7:25 am
by rdonnay
Use a STATIC variable in your window programs like this:

Code: Select all

FUNCTION Window1()

STATIC slIsRunning := .f.

IF slIsRunning
  RETURN .f.
ENDIF

slIsRunning := .t.

@ ... DCSAY ... GET ...

DCREAD GUI FIT ADDBUTTONS TO lStatus

slIsRunning := .f.

RETURN lStatus

Re: How to prevent open child window only once

Posted: Wed Feb 18, 2015 8:34 am
by Victorio
:clap: thank you for help , SETAPPWINDOW is command, what I need, but I putting it to DCGETOPTIONS, where is not possible, when I put it to DCREAD GUI, , work fine.

Roger, how simple, but work safely

Re: How to prevent open child window only once

Posted: Wed Feb 18, 2015 8:41 am
by rdonnay
Ok, I didn't realize you were using MODAL windows.

Yes, SETAPPWINDOW is the solution for that.

However, if you are using NON MODAL windows, then a static variable is a proper solution.

Re: How to prevent open child window only once

Posted: Wed Feb 18, 2015 10:06 am
by Eugene Lutsenko
Roger!

You came back from a trip?