Hiding a TFolder page

Hiding a TFolder page

Postby Enrico Maria Giordano » Tue Sep 09, 2008 6:12 pm

Dear friends, how to hide a TFolder page?

Thanks in advance.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Silvio » Tue Sep 09, 2008 6:21 pm

I think it not possible
I think tfolder page can be enable or disable ....
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Silvio » Tue Sep 09, 2008 6:22 pm

I think it not possible
I think tfolder page can be enable or disable ....
but each dialog can be an control ..I don't Know...
Best Regards, Saludos

Falconi Silvio
User avatar
Silvio
 
Posts: 3107
Joined: Fri Oct 07, 2005 6:28 pm
Location: Teramo,Italy

Postby Marco Turco » Tue Sep 09, 2008 7:21 pm

Hello Enrico,
I use this turn-around to do it.

Imagine to have a folder oFld with 3 pages: "Folder1","folder2","folder3"

then you can "hide" the folder2 at runtime with:

oFld:SetPrompt("Folder1","","Folder3")
oFld:aEnable[2]:=.f.
Best Regards,

Marco Turco
SOFTWARE XP LLP
User avatar
Marco Turco
 
Posts: 858
Joined: Fri Oct 07, 2005 12:00 pm
Location: London

Postby Enrico Maria Giordano » Tue Sep 09, 2008 8:01 pm

Marco Turco wrote:Hello Enrico,
I use this turn-around to do it.

Imagine to have a folder oFld with 3 pages: "Folder1","folder2","folder3"

then you can "hide" the folder2 at runtime with:

oFld:SetPrompt("Folder1","","Folder3")
oFld:aEnable[2]:=.f.


Thank you, but I look forward for a better solution. :-)

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Tue Sep 09, 2008 8:53 pm

Enrico,

We need to implement a new method for it, as the dialog for the folder page to hide should be removed from oFld:aDialogs.

We can't simply hide it, as the folder uses the hide and show to select them.

Also, the prompts have to be modified.
regards, saludos

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

Postby TecniSoftware » Tue Sep 09, 2008 8:56 pm

I need to create or not, some dialogs depending the rights accesss.
I do this with TPages, but is very similar code:

Add -> DEFAULT aDialogs := {} // In method Redefine

And at dialog creation:

n := 0

DEFINE DIALOG oDlg;
RESOURCE "FICHA";
TITLE "Title"

REDEFINE PAGES oPages;
ID 999;
OF oDlg

If ChkRights() // Check security access

n++
aAdd(aItems, "Datos personales" ) // manually add the dialog
aAdd(oPages:aDialogs, {})

DEFINE DIALOG oPages:aDialogs[n];
RESOURCE "FICHA_01_DATOS01";
OF oPages

REDEFINE GET oGetLegajo;
VAR oDbf:Legajo;
ID 1;
OF oPages:aDialogs[n]

EndIf

This work fine for me.

Best regards!
Alejandro Cebolido
Buenos Aires, Argentina
User avatar
TecniSoftware
 
Posts: 235
Joined: Fri Oct 28, 2005 6:29 pm
Location: Quilmes, Buenos Aires, Argentina

Postby Enrico Maria Giordano » Tue Sep 09, 2008 9:14 pm

Antonio Linares wrote:Enrico,

We need to implement a new method for it, as the dialog for the folder page to hide should be removed from oFld:aDialogs.

We can't simply hide it, as the folder uses the hide and show to select them.

Also, the prompts have to be modified.


This seems to work fine:

Code: Select all  Expand view
FUNCTION FLDHIDEITEM( oFld, nItem )

    LOCAL oDlg := oFld:aDialogs[ nItem ]

    ADEL( oFld:aPrompts, nItem, .T. )
    ADEL( oFld:aDialogs, nItem )

    oFld:aDialogs[ LEN( oFld:aDialogs ) ] = oDlg

    RETURN NIL


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Tue Sep 09, 2008 9:40 pm

Enrico,

> ADEL( oFld:aPrompts, nItem, .T. )
> ADEL( oFld:aDialogs, nItem )

I am assuming the third parameter shinks the array? If so, don't you also want to shrink aDialogs?

This function is more like a FldDeleteItem() since you can't decide to later show it again.

Regards,
James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby Enrico Maria Giordano » Tue Sep 09, 2008 10:42 pm

James Bott wrote:I am assuming the third parameter shinks the array?


Yes.

James Bott wrote:If so, don't you also want to shrink aDialogs?


No, as the dialog is already active when I decided to hide it. Leaving it working and no visible we avoid a series of problems.

James Bott wrote:This function is more like a FldDeleteItem() since you can't decide to later show it again.


I haven't tried but it should be possible to show it again simply resetting aPrompts and aDialogs to their original values.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 77 guests