Minimize main app window vs. modal

This forum is for eXpress++ general support.
Message
Author
Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Minimize main app window vs. modal

#1 Post by Victorio »

Hi,
My problem : I have main app window with menu, toolbar... from it was called other windows which are modal
It is OK, because I do not want to open several windows but only one for work.
But I want minimize application with minimize button. It is not possible if some modal window is open.
How can do it ?

this is used for main application window

...
DCGETOPTIONS WINDOWWIDTH aSize[1] ;
WINDOWHEIGHT aSize[2] ;
WINDOWCOL aPos[1] ;
WINDOWROW aPos[2] ;
BITMAP oBitmap ;
ICON ICON_EXPRESS ;
NOBUSY ;
FONT fontnt ;
EVAL { || SetAppWindow(oMenuBarh), ;
oTimer1 := DC_SetTimerEvent():new( 10,{ || _UpdateStats(GetList) } )}

DCREAD GUI SETAPPWINDOW ;
OPTIONS GetOptions
...

and this is other window
...
DCGETOPTIONS PIXEL ;
WINDOWCOL aPosx+5 ;
WINDOWROW aPosy+5 ;
WINDOWWIDTH aSize[1]*0.98 ;
WINDOWHEIGHT aSize[2]*0.95 ;
TABSTOP AUTORESIZE ;
SAYWIDTH 0 ;
FONT fontnt

DCREAD GUI ;
OPTIONS GetOptions ;
TITLE "[ ZMENOVÉ ZÁZNAMY] - [ "+nazku+" ] - [ "+nazovdbf20+" ]" ;
MODAL ;
EVAL {|o|SetAppFocus(oBrowsezz:GoTop())}

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

Re: Minimize main app window vs. modal

#2 Post by rdonnay »

If you have a pointer to the main window as a variable, you can minimize it this way:

oMainWindow:setFrameState( XBPDLG_FRAMESTAT_MAXIMIZED )
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Minimize main app window vs. modal

#3 Post by Victorio »

Hi,
Please, I do not know how can I do it ?
I have main window , and other windows are modal. Other windows must be modal. I want minimalize main window with all "child" windows.
I used eXpress functions (DCREAD, DCGETOPTIONS, DCSTATIC...for menus, ..)
If I have open application, and some other "child" window which is modal, and click to minimalize button, then mail windows blinking, and cannot minimalize.

I must create some object for main window ?
Thanks

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

Re: Minimize main app window vs. modal

#4 Post by rdonnay »

I must create some object for main window ?
Your main window already IS an object. You only need to have a variable that points to the object.

This is one way to do it. You can use a PUBLIC variable:

PUBLIC oMainWindow

// This is the DCREAD GUI that creates your main window:

DCREAD GUI EVAL {|o|oMainWindow := o}

Then you can minimize the main window, anywhere in the program with:

oMainWindow:setFrameState( XBPDLG_FRAMESTAT_MINIMIZED )

You can set it back again to normal state with:

oMainWindow:setFrameState( XBPDLG_FRAMESTAT_NORMALIZED )
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Minimize main app window vs. modal

#5 Post by Victorio »

Hi,

I tryed this, but how can I maximize this main windows again , if no other window is open ?
Main window disappear, and I not see any on bar, and also on screen.
I want to minimize main window to bottom bar.
Maybe is any mistake in my source.

A reason is, user run application, set some parameters and run some process, which running long time, minimize this application, and work anything other for example write in word. After time maximize application and continue.

I want try disable MODAL parameter and also disable MIN and MAX buttons to prevent user to close child windows.

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

Re: Minimize main app window vs. modal

#6 Post by rdonnay »

There is no reason that your main window should disappear.
It should be showing on taskbar unless you are using NOTASKBAR in your DCGETOPTIONS.

I need to see some of your code.
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Minimize main app window vs. modal

#7 Post by Victorio »

here is part of source, in INFOKAT.PRG is MAIN. from it is calling APPMENU2 .
After select MENUITEM is calling WIC() in IK12.PRG

I left there only the most important part, to see, how I opening window.

Please, look to it, if you have little time

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

Re: Minimize main app window vs. modal

#8 Post by rdonnay »

Did you intend to attach a file?
The eXpress train is coming - and it has more cars.

Victorio
Posts: 633
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Minimize main app window vs. modal

#9 Post by Victorio »

sorry, here is attach file, :oops:
Attachments
ModalAppWin.zip
(2.84 KiB) Downloaded 638 times

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

Re: Minimize main app window vs. modal

#10 Post by rdonnay »

I made a few changes to your source code.

I could not compile and run it because there is a lot missing but I think these changes will work for you.

1. Your WIC() window should NOT be a Modal window. Instead, it should be a child window of the main window. Also, it should be running in its own thread. I made the following changes to accomplish this:

Run in new thread and pass the drawingArea of the main window.

Code: Select all

DCMENUITEM "&B-Parcely registra C" PARENT oUdajeKatastra ;
            ACTION {||o := Thread():new(), ;
                      o:start({||Zvku(),Wic(oDlg:drawingArea),unblokokno()})}
Remove EVAL clause of DCGETOPTIONS. Add EVAL clause to DCREAD GUI.

Code: Select all

DCGETOPTIONS WINDOWWIDTH aSize[1] ;
                     WINDOWHEIGHT  aSize[2] ;
                     WINDOWCOL aPos[1] ;
                     WINDOWROW aPos[2] ;
             BITMAP oBitmap ;
                     ICON ICON_EXPRESS ;
                     NOBUSY ;
             FONT fontnt ;
                    ;// EVAL { |o|oDlg SetAppWindow(oMenuBarh), ;
                    ;//           oTimer1 := DC_SetTimerEvent():new( 100,{ || _UpdateStats(GetList) } )}

DCREAD GUI SETAPPWINDOW ;]
   TITLE "INFOKAT Win"+verzia ;
   OPTIONS GetOptions ;
   EVAL {|o|oDlg := o, ;
            oTimer1 := DC_SetTimerEvent():new( 100,{ || _UpdateStats(GetList) }
Receive a pointer to the main window drawingArea as oAppWindow

Code: Select all

FUNCTION wic( oAppWindow )
Make this window a child of oAppWindow. Cannot be MODAL.

Code: Select all

DCREAD GUI ;
           OPTIONS GetOptions ;
           TITLE "[ PARCELY REGISTRA C ] - [ "+nazku+" ] - [ "+nazovdbf1+" ]" ;
           ;// MODAL ;
           APPWINDOW oAppWindow ;
           EVAL {|o| ;
		SetAppFocus(oBrowsepa:GetColumn(1)),;
	                oBrowsepa:RefreshAll(),;
	                oBrowsevl:RefreshAll(),;
	                oBrowsecs:RefreshAll(),;
		if(zoompor=.T.,({oBrowsepa_a:RefreshAll()}),({})) ;
 
Attachments
ModalAppWin.zip
(2.92 KiB) Downloaded 653 times
The eXpress train is coming - and it has more cars.

Post Reply