Page 1 of 1
Hide page in control tab
Posted: Tue Nov 03, 2009 9:16 pm
by l3whmg
Hy guys,
I don't find documentation (and I don't know) if there is the ability to hide a page in a tab control. Is there?
Many thanks in advance to everyone.
Re: Hide page in control tab
Posted: Wed Nov 04, 2009 10:07 am
by gfilatov
Hi Luigi,
There is not a standard way for this feature but you can use a trick
Take a look for the
working sample below:
Code: Select all
#include "minigui.ch"
static nPage := 2
Function Main
DEFINE WINDOW Form_1 ;
AT 0,0 WIDTH 480 HEIGHT 300 ;
TITLE 'TAB / Page' ;
MAIN
DEFINE MAIN MENU
DEFINE POPUP 'Option'
MENUITEM 'Hide Page 2' ACTION f_hide_page( 2 )
MENUITEM 'Add Page 2' ACTION f_add_page( 2 )
SEPARATOR
MENUITEM 'Exit' ACTION ThisWindow.Release
END POPUP
END MENU
ON KEY F1 ACTION f_page_value( 1 )
ON KEY F2 ACTION f_page_value( 2 )
DEFINE STATUSBAR
STATUSITEM "" ACTION nil
END STATUSBAR
DEFINE TAB Tab_1 ;
AT 10,10 ;
WIDTH 450 ;
HEIGHT 200 ;
VALUE 1 ;
TOOLTIP 'Tab Control' ;
ON CHANGE f_change()
PAGE 'Press F1'
@ 60,10 textbox txt_1 value '1-uno'
@ 90,10 textbox txt_2 value '2-Dos'
@ 120,10 textbox txt_3 value '3-Tres'
END PAGE
PAGE 'Press F2'
@ 60,100 textbox txt_a value 'A-Uno'
@ 90,100 textbox txt_b value 'B-Dos'
END PAGE
END TAB
f_change()
END WINDOW
Form_1.Center
Form_1.Activate
Return Nil
*____________________________________________________*
func f_hide_page( n_para )
if nPage > 1
nPage--
Form_1.txt_a.Hide
Form_1.txt_b.Hide
Form_1.tab_1.DeletePage ( 2 )
form_1.tab_1.value := n_para - 1
Form_1.tab_1.refresh()
F_CHANGE()
endif
return
*____________________________________________________*
func f_add_page( n_para )
if nPage < 2
nPage++
Form_1.Tab_1.AddPage ( n_para , 'Press F2' )
form_1.tab_1.caption( n_para ) := 'Press F2'
Form_1.Tab_1.AddControl ( 'txt_a', n_para , 60 , 100 )
Form_1.Tab_1.AddControl ( 'txt_b', n_para , 90 , 100 )
Form_1.txt_a.Show
Form_1.txt_b.Show
form_1.tab_1.value := n_para
F_CHANGE()
endif
return
*____________________________________________________*
func f_page_value( n_para )
form_1.tab_1.value := n_para
f_change()
return
*____________________________________________________*
func f_change
n_value = form_1.tab_1.value
if n_value = 1
form_1.txt_1.setfocus
else
form_1.txt_a.setfocus
endif
Form_1.StatusBar.Item(1) := ;
'Form_1.Tab_1.Caption(' + alltrim(str(n_value)) + ') = '+;
form_1.tab_1.caption( form_1.tab_1.value )
return nil
I hope that you give idea(s)...
Re: Hide page in control tab
Posted: Wed Nov 04, 2009 12:25 pm
by Roberto Lopez
gfilatov wrote:Hi Luigi,
There is not a standard way for this feature but you can use a trick
Take a look for the
working sample below:
Thanks for the sample Grigory.
Re: Hide page in control tab
Posted: Mon Nov 09, 2009 8:42 pm
by l3whmg
Hi Grigory,
thanks a lot for your solution: now I'll try.
I wish to make a clarification on my question (because of my bad English): I want to "disable" and not to "hide" even if the result is "similar".
In any case: grazie, proverò!