Page 1 of 1
Working on Mdi
Posted: Wed Jan 12, 2022 10:05 am
by Silvio.Falconi

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?
Re: Working on Mdi
Posted: Wed Jan 12, 2022 10:25 am
by Antonio Linares
Dear Silvio,
Do you use static oPaziente ?
Re: Working on Mdi
Posted: Wed Jan 12, 2022 11:12 am
by Silvio.Falconi
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
Re: Working on Mdi
Posted: Wed Jan 12, 2022 1:21 pm
by karinha
Re: Working on Mdi
Posted: Wed Jan 12, 2022 3:21 pm
by karinha
.OR.
Code: Select all | Expand
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
Re: Working on Mdi
Posted: Wed Jan 12, 2022 3:31 pm
by karinha
.AND.
Code: Select all | Expand
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
....
Re: Working on Mdi
Posted: Thu Jan 13, 2022 8:09 am
by Silvio.Falconi
Perhaps I found a solution But I not understood if it can go good
On Main.prgOn buttonbar of Main.prgCode: Select all | Expand
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.prgCode: Select all | Expand
MENUITEM oItem[1] PROMPT "Anagrafica pazienti" ACTION TPaziente():New(oItem[1],oBtns[1]):Activar(oItem[1],oBtns[1]) RESOURCE "pazienti"
On TPaziente.prgI 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
IF !Empty(oItem)
oItem:Disable()
ENDIF
IF !Empty(oBtnB)
oBtnB:Disable()
ENDIF
oMOpc:=oItem
oBBar:=oBtnB
on Method activar()Code: Select all | Expand
METHOD Activar(oItem,oBtnB) CLASS TPaziente
ACTIVATE WINDOW ::oWinClients MAXIMIZED ;
VALID (::oWinClients:=Nil,Exit_Wnd(oItem,oBtnB),.T.)
RETURN NIL
Code: Select all | Expand
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
the button of buttonbar is disabled but not is on different color 
but I check it is disabled
any solution ?
Re: Working on Mdi
Posted: Thu Jan 13, 2022 12:47 pm
by karinha
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.