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.
Hide page in control tab
Moderator: Rathinagiri
Hide page in control tab
Luigi from Italy
www.L3W.it
www.L3W.it
Re: Hide page in control tab
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:
I hope that you give idea(s)...
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
Last edited by gfilatov on Wed Nov 04, 2009 12:35 pm, edited 1 time in total.
Kind Regards,
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
Grigory Filatov
"Everything should be made as simple as possible, but no simpler." Albert Einstein
- Roberto Lopez
- HMG Founder
- Posts: 4004
- Joined: Wed Jul 30, 2008 6:43 pm
Re: Hide page in control tab
Thanks for the sample Grigory.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:
Regards/Saludos,
Roberto
(Veritas Filia Temporis)
Roberto
(Veritas Filia Temporis)
Re: Hide page in control tab
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ò!
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ò!
Luigi from Italy
www.L3W.it
www.L3W.it