Working on Mdi

Working on Mdi

Postby Silvio.Falconi » Wed Jan 12, 2022 10:05 am

Image

When I Open the Window child I made


CLASS TPaziente
DATA oWin

METHOD New() CLASS TPaziente

....

if ::oWin == nil

::oPaziente := TClienti():New()
::oPaziente:SetOrder( "FIRST" )
::oPaziente:GoTop()
::cTitulo := ""

DEFINE ICON ::oIcon RESOURCE "

DEFINE WINDOW ::oWin MDICHILD
....


else
::oWin:SetFocus()
endif

RETURN Self

this is to avoid opening the same window
but unfortunately it does not work because it reopens again how can I not make the same window open again?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: Working on Mdi

Postby Antonio Linares » Wed Jan 12, 2022 10:25 am

Dear Silvio,

Do you use static oPaziente ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41314
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Working on Mdi

Postby Silvio.Falconi » Wed Jan 12, 2022 11:12 am

Antonio Linares wrote:Dear Silvio,

Do you use static oPaziente ?


CLASS TPaziente
DATA oWinClients
DATA oBar
DATA oPaziente
DATA oLbx
DATA cTitulo
DATA oTabs
DATA oIcon
DATA oCbx
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: Working on Mdi

Postby karinha » Wed Jan 12, 2022 1:21 pm

\samples\ADORICK.PRG

Code: Select all  Expand view

   oBtn1:Disable()
   oBtn2:Disable()
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Working on Mdi

Postby karinha » Wed Jan 12, 2022 3:21 pm

.OR.

Code: Select all  Expand view

   PUBLIC lLigaBtnOrca := .T.

   DEFINE BUTTON oOrcam RESOURCE "ORCAMENTO" OF oBar PROMPT "Orçamento"      ;
      MESSAGE OemToAnsi( "Gera‡Æo do Or‡amento"  )                           ;
      ACTION( ORCAMENTO( oOrcam ) )                                          ;
      TOOLTIP OemToAnsi( "Gera‡Æo do Or‡amento"  )                           ;
      NOBORDER GROUP WHEN( lLigaBtnOrca )


   MENUITEM oMenuOrca PROMPT "&Orçamento"      ;
      COLORMENU   CLR_LGREEN,   CLR_HBLUE BOLD ;
      LEFTCOLOR   CLR_WHITE,    CLR_YELLOW     ;
      COLORPNEL   CLR_CYAN,     CLR_BROWN      ;
      COLORSELECT CLR_MSPURPLE, CLR_LGREEN     ;
      WHEN( lLigaBtnOrca )                     ;
      RESOURCE "152"


FUNCTION MDI_SILVIO()

   lLigaBtnOrca := .F.

   BUTTON oExit... ACTION( ..., lLigaBtnOrca := .T. )

RETURN NIL
 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Working on Mdi

Postby karinha » Wed Jan 12, 2022 3:31 pm

.AND.

Code: Select all  Expand view


STATIC oWndChild, lAbreOrcam := .F.

FUNCTION ORCAMENTO( oOrcam )

   PUBLIC lFechaJan, lFechaWin, lLigaBtnOrca

   lFechaJan      := .F.
   lFechaWin      := .F.

   // Para Impedir Uma 2¦ Abertura de Janela!!!
   IF lAbreOrcam = .F.

       lAbreOrcam := .T.

   ELSE

      MsgInfo( OemToAnsi( "ATTENTION:                     " +CRLF+ ;
                          "THE BUDGET WINDOW IS ALREADY   " +CRLF+ ;
                          "OPENED IN THE PROGRAM WHEEL    " +CRLF+ ;
                          "MAXIMIZE THE WINDOW TO WORK.   " +CRLF+ ;
                          "USE THE <Exit> BUTTON TO CLOSE." +CRLF+ ;
                          "BEWARE MAY BREAK THE BANKS.    " ),    ;
               OemToAnsi( "WINDOW IS ALREADY OPEN ON WHEEL" ) )

       lLigaBtnOrca := .F.
       oOrcam:Disable()
       oOrcam:Refresh()

       lAbreOrcam := .F.

       RETURN NIL

   ENDIF

   ....

 
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil

Re: Working on Mdi

Postby Silvio.Falconi » Thu Jan 13, 2022 8:09 am

Perhaps I found a solution But I not understood if it can go good

On Main.prg

Code: Select all  Expand view
Static oItem[40], oBtns[20]


On buttonbar of Main.prg

Code: Select all  Expand view
DEFINE BUTTON oBtns[1] RESOURCE "paciente" OF ::oBar NOBORDER ;
      ACTION TPaziente():New(oItem[1],oBtns[1]):Activar(oItem[1],oBtns[1])  


On menu of Main.prg

Code: Select all  Expand view
MENUITEM oItem[1] PROMPT "Anagrafica pazienti" ACTION TPaziente():New(oItem[1],oBtns[1]):Activar(oItem[1],oBtns[1])   RESOURCE "pazienti"


On TPaziente.prg
Code: Select all  Expand view
MemVar oMOpc, oBBar

I don't know if it is right to use Memvar, in clipper I never used them or so I remember

On method New()of Tpaziente

Code: Select all  Expand view
IF !Empty(oItem)
      oItem:Disable()
   ENDIF

   IF !Empty(oBtnB)
      oBtnB:Disable()
   ENDIF

   oMOpc:=oItem
   oBBar:=oBtnB



on Method activar()
Code: Select all  Expand view
METHOD Activar(oItem,oBtnB) CLASS TPaziente
   ACTIVATE WINDOW ::oWinClients MAXIMIZED ;
   VALID     (::oWinClients:=Nil,Exit_Wnd(oItem,oBtnB),.T.)
   RETURN NIL


Code: Select all  Expand view
STAT FUNC Exit_Wnd(oItem,oBtnB)
    oBtnB:Enable()
    oItem:Enable()
RETURN (.T.)


So, This blocks both the main menu and the buttonbar of main.prg

For Now it seem run ok , I saw this technique on a source code by Alfredo Arteaga which I hope is fine even if I haven't heard from it for years

But there would be a problem.

while in the menu I see the locked option


Image

the button of buttonbar is disabled but not is on different color

Image

but I check it is disabled

any solution ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 6768
Joined: Thu Oct 18, 2012 7:17 pm

Re: Working on Mdi

Postby karinha » Thu Jan 13, 2022 12:47 pm

Si es posible haz una DEMO como la que hizo Goosfancito. Es más fácil ayudarte. Aquí, mostrando la clase:

If possible, make a DEMO like the one Goosfancito did. It's easier to help you. Here, showing the class:

http://forums.fivetechsupport.com/viewtopic.php?f=6&t=41284&sid=55eca92ee4e3cc58facdf99ecacdf610

¿Has probado con PÚBLIC?

Have you tried with PUBLIC?

Regards.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
User avatar
karinha
 
Posts: 7213
Joined: Tue Dec 20, 2005 7:36 pm
Location: São Paulo - Brasil


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 67 guests