Recent

Author Topic: SOLVED: TDBNavigator question  (Read 448 times)

jptferreira

  • New Member
  • *
  • Posts: 17
SOLVED: TDBNavigator question
« 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! ;)
« Last Edit: April 18, 2019, 08:18:39 pm by jptferreira »

howardpc

  • Hero Member
  • *****
  • Posts: 3075
Re: TDBNavigator question
« Reply #1 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.

jptferreira

  • New Member
  • *
  • Posts: 17
Re: TDBNavigator question
« Reply #2 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!

howardpc

  • Hero Member
  • *****
  • Posts: 3075
Re: TDBNavigator question
« Reply #3 on: April 18, 2019, 05:49:20 pm »
Is the dbnavigator parented by a pagecontrol tabsheet, or is it parented by the containing form?

jptferreira

  • New Member
  • *
  • Posts: 17
Re: TDBNavigator question
« Reply #4 on: April 18, 2019, 06:12:55 pm »
It is on the same form and inside of a TPanel.

Thanks

lucamar

  • Hero Member
  • *****
  • Posts: 1960
Re: TDBNavigator question
« Reply #5 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;
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.

jptferreira

  • New Member
  • *
  • Posts: 17
Re: TDBNavigator question
« Reply #6 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! :)

lucamar

  • Hero Member
  • *****
  • Posts: 1960
Re: SOLVED: TDBNavigator question
« Reply #7 on: April 18, 2019, 11:30:22 pm »
Glad it helped :)
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus 2.0.2/2.0.4  - FPC 3.0.4 on:
(K|L)Ubuntu 12..16, Windows XP SP3, various DOSes.