Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Navigation Controls disabled?

91 views
Skip to first unread message

Ernesto Buenrostro

unread,
Aug 16, 2005, 1:26:30 PM8/16/05
to
Hi every body

I have a problem with navigation controls, I have a master-detail relation
Ex. Customers and contacts so in my form I have a TPageControl with two
TabSheets, on the first tab I have controls added to the customer info in
the second tab I have controls with contact's info, but when I go to the
sencond tab the navigation controls get disabled, when I back to the first
tab, get enabled ...

it's ok. that feature o how I can disable that?

Some commentaries about that?

Thanks in advanced

Ernesto Buerostro

Ron H

unread,
Aug 16, 2005, 2:18:46 PM8/16/05
to
Unless you are doing something in code, the standard VCL controls do not
just enable/disable themselves. When you say the controls are being
disabled, are they graying out or just "not working"?

Are you using the same navigation controls for all sheets? For example, are
you using one DBNavigator for all sheets? If so, you need to make sure you
change the datasource for the DBNavigator when you change tabsheets.
Otherwise when you change to tab2, the navigator is still moving you around
the data on tab1.

Regards,
Ron

"Ernesto Buenrostro" <ernesto...@hotmail.com> wrote in message
news:430221c0$1...@newsgroups.borland.com...

Ernesto Buenrostro

unread,
Aug 16, 2005, 3:14:42 PM8/16/05
to
Thanks Ron

but I'm don't have any code to change the control DataSource, in the second
sheet I have only a grid to show a detail list. so I don't need controls to
manage that sheet, the navigation controls get grayed when I change from
sheet.

Ernesto Buenrostro

"Ron H" <rhe...@leavethisoutpearlrecovery.com> escribió en el mensaje
news:4302...@newsgroups.borland.com...

Ron H

unread,
Aug 18, 2005, 11:20:51 AM8/18/05
to
Can you explain your form layout a bit?
Is the navigation bar owned by the tabsheet (check Object Tree view)
Can you confirm (look at your Object Tree View) that you only have one
navigation bar on your form?
Do you have an OnClick OnChanging or OnChange event defined for your
TPageControl? For instance, do you issue a DisableControls command anywhere
in your code?

The reason I am asking these questions is that what you are describing is
not normal behavior for navigation components. To show you, run the
following quick test:

1. Start New Application
2. Put two BDE TTable components on Form. For both set Database to "DBDEMOS"
3. Pur two TDatasource components on form. For Datasource1, set Dataset to
"Table1", for Datasource2 set Dataset to "Table2"
4. For Table1, set TableName to customer.db and set Active to True
5. For Table2, set Tablename to orders.db, set IndexName to "Custno", Set
MasterSource to "Datasource1", Click Masterfields button and join Custno on
both tables, finally set Active to True.
6. On your Form, put a DBNavigator, set Align to "alBottom" and set
datasource to Datasource1
7. Add a TPageControl to form and set Align to "alClient".
8. Right-Click on TpageControl and select "NewPage". Do that a second time
to add a second page.
9. Select Tabsheet1, put a DBGrid on the tabsheet and set DBGrid's Align
Property to alClient and its Datasource to "Datasource1"
10. Select Tabsheet2, put a DBgrid on the tabsheet and set DBGrid's Align
Property to alClient and its Datasource to "Datasource2"
11. Run application

You'll see that when you click on tabsheets it does not impact DBNavigator.
When you use DBNavigator to move forward or backward, it is moving through
datasource1. If you are on tab2, it still is just moving through the master
records on tab1 and refreshing the grid on tab2.

"Ernesto Buenrostro" <ernesto...@hotmail.com> wrote in message

news:4302...@newsgroups.borland.com...

Ron H

unread,
Aug 18, 2005, 11:26:44 AM8/18/05
to
Actually, issuing a "disablecontrols" would not gray out your nav bar. You
must either issue "navbar.enabled := false" or your dataset is no longer
active.


"Ron H" <rhe...@leavethisoutpearlrecovery.com> wrote in message
news:4304a746$1...@newsgroups.borland.com...

Ernesto Buenrostro

unread,
Aug 19, 2005, 1:12:44 AM8/19/05
to
Thanks for your answer Ron

Ok. I'll describe my application

I have my navigations controls workin with Actions (dataset actions), I have
A TPageControl, I'm have two ClientDataSet, Because I'm working with SQL
Server, so I have DataControls In one TabSheet, and a Grid in the second
TTabSheet so when I change to the second tabsheet my constrol get disabled,
I haven't any code for onchange, click ... etc TPagecontrol Events ... it's
why I get so confused about that thing, any that I can see is tha if add a
control relate to the master table, this still enabled ... but if I delete
that, get disabled ... *-)


thanks for all

Ernesto Buenrostro


"Ron H" <rhe...@leavethisoutpearlrecovery.com> escribió en el mensaje

news:4304a8a5$1...@newsgroups.borland.com...

Ron H

unread,
Aug 19, 2005, 12:22:05 PM8/19/05
to
If you have data controls on tab one, and you switch to tab two, how do you
know the data controls are being disabled? You shouldn't even see them (you
only see the active tab)

"Ernesto Buenrostro" <ernesto...@hotmail.com> wrote in message

news:4305...@newsgroups.borland.com...

Ernesto Buenrostro

unread,
Aug 19, 2005, 1:28:22 PM8/19/05
to
Ron H


I only have navigation controls for the master table, I don't need
navigation controls for the second table, my second tavle is only to show a
list

I don't need to change the data source
my contros are out of the TPageControl, they're in a toolbar

Thanks for your help.

Ernesto Buenrostro


"Ron H" <rhe...@leavethisoutpearlrecovery.com> escribió en el mensaje

news:43060719$1...@newsgroups.borland.com...

Ron H

unread,
Aug 19, 2005, 5:32:47 PM8/19/05
to
Okay, I believe I understand now. If you have no code attached to the
PageControl events then some other event in your code is affecting things.
(My earlier example showed you how nothing regarding changing tabs should
affect your controls).

My suggestion would be to create a dummy onChanging event in for your
PageControl and put a breakpoint there and step through your code (F7) from
that point. Check to see if you are closing the Master dataset perhaps
(which would close the Master and gray out the controls without affecting
the detail grid on tab2) or maybe you are affecting the datasource somehow.

Example of a dummy event would be:

procedure TForm1.PageControl1Changing(Sender: TObject;
var AllowChange: Boolean);
begin
allowchange := true;
end;


"Ernesto Buenrostro" <ernesto...@hotmail.com> wrote in message

news:4306...@newsgroups.borland.com...

Ernesto Buenrostro

unread,
Aug 19, 2005, 9:18:59 PM8/19/05
to
thanks Ron


I do something like that, I put a button to get the state of the
ClientDataSet, And I get this Active=True, and in state = [dsBrowse]
this is so curiouse, like if I add a control linked to the dataset and the
navigation sistem Get to work ok. but If I Delete that control I go back and
get the navigation System Disabled ... :S, why?, I don't know, it's why I
ask if that is a property.


maybe I must to go and see the code of the controls to see what's happening
...

I started that system with ECO, but due the ide have a litle issues, I
desided go to Delphi VCL .Net, but I find other issues in .net, so Go back
to higly tested win32 architecture, but I get that issue, I would to go
pascal :S ... jejeje


thanks for all

don't worry for that thing, I'm thinking to write my own code for navigation
controls


Ernesto Buenrostro


"Ron H" <rhe...@leavethisoutpearlrecovery.com> escribió en el mensaje

news:43065dc1$1...@newsgroups.borland.com...

Ron H

unread,
Aug 21, 2005, 12:26:46 PM8/21/05
to
I'm sorry, but something you are saying is not making sense. If the
clientdataset is Active and your datasource dataset is set to the
clientdataset, and the control datasource is set to your datasource
component, the controls should not be disabled. Again, look at the simple
example I gave you earlier in the thread. There is no property or default
behavior of the components that act the way you describe.

Anything not behaving that way is being caused by something in your code. I
will e-mail you if you would like to send me a sample of code to look at,
but I think we've belabored the point here enough :-).

Best of luck,
Ron

"Ernesto Buenrostro" <ernesto...@hotmail.com> wrote in message

news:4306...@newsgroups.borland.com...

0 new messages