Lazarus

Programming => General => Topic started by: jptferreira on April 18, 2019, 03:14:19 pm

Title: SOLVED: TDBNavigator question
Post by: jptferreira on April 18, 2019, 03:14:19 pm
I'm in need of hide tdbnavigator after switching to a TPageControl inside of the same form. I can hide it if the code is inside of the actual form but if it is inside of the TPageControl that is inside of that form.. then it doesn't work. Someone can shed a light on my issue?
Thanks! ;)
Title: Re: TDBNavigator question
Post by: howardpc on April 18, 2019, 04:12:35 pm
... I can hide it if the code is inside of the actual form but if it is inside of the TPageControl that is inside of that form.. then it doesn't work.
How does code "inside the actual form" differ from code "inside the TPageControl"?

Quote
Someone can shed a light on my issue?
Not without seeing the code that fails to do what you want it to do.
Title: Re: TDBNavigator question
Post by: jptferreira on April 18, 2019, 04:51:09 pm
When I add the ClientDBNV.Visible:=false;  it works if I use it when I have the that part of the form active. My problem is when I activate the TPageControl that has 3 pages. I need to be able to issue that command when a certain ActivePage becomes in use, however it only allow to do it for the whole Tpagecontrol.
To be more clear:
The command works but I need for it to only work when I select a certain page tab. That is not working because that OnShow option affects the whole TPageControl (all the pages on it)... need to know how to have it enabled only when that page is selected to disable the dbnavigator... I hope this helps.  Thanks!
Title: Re: TDBNavigator question
Post by: howardpc on April 18, 2019, 05:49:20 pm
Is the dbnavigator parented by a pagecontrol tabsheet, or is it parented by the containing form?
Title: Re: TDBNavigator question
Post by: jptferreira on April 18, 2019, 06:12:55 pm
It is on the same form and inside of a TPanel.

Thanks
Title: Re: TDBNavigator question
Post by: lucamar on April 18, 2019, 07:11:07 pm
Add a handler for the page control OnChange event. For example, assuming it's the third tab:
Code: Pascal  [Select]
  1. procedure TForm1.PageControlChange(Sender: TObject);
  2. begin
  3.   ClientDBNV.Visible := PageControl.ActivePageIndex = 2;
  4. end;
Title: Re: TDBNavigator question
Post by: jptferreira on April 18, 2019, 08:17:22 pm
That did it! I feel bad I didn't think about it! I believe that too much going on at the office sometimes we can't think about the quick solution.
THANK YOU! :)
Title: Re: SOLVED: TDBNavigator question
Post by: lucamar on April 18, 2019, 11:30:22 pm
Glad it helped :)