Topic: Hiding tab...

Hi all,


How to hide a tab based on tab page content. In this case I like to hide the tab if memo field doesn't contains any text. Memo field is on same tab page that I like to hide. Tried the following under form1 onShow but didn't work.

If Form1.MemKeyNotes01.text  = '' then Form1.TabSheet2.TabVisible := False else Form1.TabSheet2.TabVisible := True;
Adam
God... please help me become the person my dog thinks I am.

Re: Hiding tab...

https://fileworld.pavlenkovv.ru/img/ScreenRecorderProject663.gif

Re: Hiding tab...

Hi Adam, Vladimir,
There might be a simple answer to this contained elsewhere in your project but this seems a bit of a 'catch-22'.
If the tabsheet is invisible because the memo field is blank, how do you then access the tabsheet to add some text to the memo field?
Shouldn't the condition (ie memo field blank or not blank) be held somewhere else (ie on a different tabsheet that is always visible)?
Derek.

Re: Hiding tab...

Hi all,


Adam,
Your code is working.
But...
If your Memo contains at least one space, the command will not work.
I would recommend additionally using the Trim() function.

If Trim(Form1.MemKeyNotes01.text) ...

Re: Hiding tab...

Hi Vladimir,
Hi Derek,
Hi Sparrow,


Thank you very much guys...
All replies are truly appreciated.....


Vladimir, thanks for the animated explanation.


Derek, you must have extraordinary special talents... Yes, the error was at my side, using wrong TabSheet name.


Sparrow, thanks for extra info, which is very useful.

Adam
God... please help me become the person my dog thinks I am.