Minimizar varios formularios a la vez

Post Reply
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Minimizar varios formularios a la vez

Post by Compuin »

Hola foro,

Estoy manejando 2 formularios o ventanas. Una tiene el MAIN del programa y el otro es llamado en forma NO MODAL.

Como podria hacer para que cuando el formulario que contiene el MAIN se minimize pueda minimizar los otros formularios abiertos. LO que quiero hacer es algo parecido a lo que se hace cuado el formulario es MDI pero sin utlilizarlos como tal

Atento a sus comentarios
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Minimizar varios formularios a la vez

Post by karinha »

Podrias poner una imagen para mejor comprender?

Creo que la mejor forma sea usando MDICHILD tipo asi:

Image

saludos.
João Santos - São Paulo - Brasil
User avatar
karinha
Posts: 4882
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Minimizar varios formularios a la vez

Post by karinha »

João Santos - São Paulo - Brasil
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

karinha wrote:Podrias poner una imagen para mejor comprender?

Creo que la mejor forma sea usando MDICHILD tipo asi:

Image

saludos.
Hola Joao,

Quiero hacer exactamente lo que hace MDI / MDICHILD entre 2 ventanas pero sin usar MDI
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Minimizar varios formularios a la vez

Post by cnavarro »

Mira a ver si te ayuda a implementarlo

http://forums.fivetechsupport.com/viewt ... g+mdichild
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

cnavarro wrote:Mira a ver si te ayuda a implementarlo

http://forums.fivetechsupport.com/viewt ... g+mdichild
Gracias maestro, funciona parcialmente ya que necesito:

- Que no sea Modal
- Que tenga boton de minimizar

Es posible incorporar esto?
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Minimizar varios formularios a la vez

Post by cnavarro »

No Modal es, si no no se prodría hacer
Pero, lo has probado?
C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

cnavarro wrote:No Modal es, si no no se prodría hacer
Pero, lo has probado?
No modal pero me deja siempre el dialogo visible la idea es que lo compagine entre dialogos y al minimizar que se vaya a la barra de tareas

use NOWAIT y no me dio ese resultado
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Minimizar varios formularios a la vez

Post by nageswaragunupudi »

Add this code to the main window, before activating it.

Code: Select all

   oWnd:bResized  := <|nType|
      local aWnd  := GetAllWin()
      if nType == 1
         AEval( aWnd, { |o| If( o:ClassName == "TWINDOW" .and. o:hWnd != oWnd:hWnd, ;
                            o:Iconize(), nil ) } )
      endif
      return nil
      >
 
Regards

G. N. Rao.
Hyderabad, India
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

nageswaragunupudi wrote:Add this code to the main window, before activating it.

Code: Select all

   oWnd:bResized  := <|nType|
      local aWnd  := GetAllWin()
      if nType == 1
         AEval( aWnd, { |o| If( o:ClassName == "TWINDOW" .and. o:hWnd != oWnd:hWnd, ;
                            o:Iconize(), nil ) } )
      endif
      return nil
      >
 
Hello Mr Rao, sorry I couldn't gei it

Code: Select all

#include "fivewin.ch"

#define AS_DIALOG

function Main()

   local oWnd, oBar, oMenu

   SetGetColorFocus()

   DEFINE WINDOW oWnd MDI TITLE "DIALOG IN WINDOW"
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007

   DEFINE BUTTON OF oBar PROMPT "DIALOG"     CENTER ACTION CreateDialog( AS_DIALOG )

   ACTIVATE WINDOW oWnd

return nil


static function CreateDialog( nAs )

   local oDlg

   DEFINE DIALOG oDlg TITLE "DIALOGO" ;
   STYLE nOr( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME,;
                               WS_MINIMIZEBOX )


   ACTIVATE DIALOG oDlg CENTERED NOWAIT

return oDlg
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Minimizar varios formularios a la vez

Post by nageswaragunupudi »

Non modal resizable dialogs are always minimized when the main window is minimized.
You do not have to write any special code to do that.
Test this program:

Code: Select all

#include "fivewin.ch"

function TestMin()

   local oWnd, oBar

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
   DEFINE BUTTON OF oBar PROMPT "Dialog" ACTION OpenDlg()

   oWnd:nWidth    := 800
   oWnd:nHeight   := 600

   ACTIVATE WINDOW oWnd CENTERED

return nil

function OpenDlg()

   local oDlg

   DEFINE DIALOG oDlg RESIZABLE
   ACTIVATE DIALOG oDlg CENTERED NOMODAL

return nil
 
If the main window is minimized, the non-modal dialog also is minimized.

Instead of writing this long:

Code: Select all

   DEFINE DIALOG oDlg TITLE "DIALOG" ; 
   STYLE nOr ( WS_POPUP, WS_VISIBLE, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME ;; 
                               WS_MINIMIZEBOX ) 
 
you can simply write

Code: Select all

DEFINE DIALOG oDlg TITLE "DIALOG" RESIZABLE
 
Regards

G. N. Rao.
Hyderabad, India
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

nageswaragunupudi wrote:Non modal resizable dialogs are always minimized when the main window is minimized.
You do not have to write any special code to do that.
Test this program:

Code: Select all

#include "fivewin.ch"

function TestMin()

   local oWnd, oBar

   DEFINE WINDOW oWnd
   DEFINE BUTTONBAR oBar OF oWnd SIZE 100,32 2007
   DEFINE BUTTON OF oBar PROMPT "Dialog" ACTION OpenDlg()

   oWnd:nWidth    := 800
   oWnd:nHeight   := 600

   ACTIVATE WINDOW oWnd CENTERED

return nil

function OpenDlg()

   local oDlg

   DEFINE DIALOG oDlg RESIZABLE
   ACTIVATE DIALOG oDlg CENTERED NOMODAL

return nil
 
If the main window is minimized, the non-modal dialog also is minimized.
Mr Rao,

Setting the dialog as NOMODAL works as I want. The only issue is when I minimize them, I can not find them on the taskbar

How could I solve this???
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Minimizar varios formularios a la vez

Post by nageswaragunupudi »

That is Windows' behavior.
But when the main window is restored, the non-modal dialogs are also restored.
Regards

G. N. Rao.
Hyderabad, India
Compuin
Posts: 1017
Joined: Tue Dec 28, 2010 1:29 pm

Re: Minimizar varios formularios a la vez

Post by Compuin »

nageswaragunupudi wrote:That is Windows' behavior.
But when the main window is restored, the non-modal dialogs are also restored.
Yes, thanks a lot
Post Reply