Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Disabling TabbedNoteBook Tabs...

Posted on 1998-05-11
7
Medium Priority
?
917 Views
Last Modified: 2012-06-27
Hello, in my Delphi v3 app I have a TabbedNoteBook with 10 tabs. When I am in a certain one of these tabs, I wish to prevent the user from clicking on another tab. The only way he should be able to get to another tab is by pressing a specific button on the screen...not by clicking another tab. Therefore I essentially want to 'disable' the tabs when he is in this screen. I try 'TabbedNoteBook1.enabled:=false', but this not only disables the tabs, but disables every component within the tab the user is currently on - definitely not what I want. How can I just disable the tabs from being clicked but still leave the components enabled?

Cheers!
  Shawn Halfpenny
  drumme59@sprint.ca
0
Comment
Question by:aztec
7 Comments
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344343
Hi aztec,

I think it's not possible... At least when I found out of this problem I didn't found a solution to it. But maybe somebody did... It's already a long time ago.

You should use pagecontrol which can handle this

Regards, ZiF.
0
 

Accepted Solution

by:
BigMadDrongo earned 200 total points
ID: 1344344
You need to monitor the changing event.  The tab index during the changing event is the previous tab.  What you need to do is define a global variable to store the starting tab, and in the onchange event, set the current tab to that.

E.G.

type
  MyForm(TForm)
    Tab: TTabControl
  end;

var
  MyTab: integer;
  Allowed: boolean;

procedure MyForm.TabChanging(Sender: TObject);
begin
  MyTab := Tab.TabIndex;
end;

procedure MyForm.TabChange(Sender: TObject);
begin
  if Allowed then
    exit;
  if Tab.TabIndex <> MyTab then
    Tab.TabIndex := MyTab;
end;

procedure MyForm.ButtonClick(Sender: TObject);
begin
  Allowed := True;
  Tab.TabIndex := Value;
  Allowed := False;
end;

This doesn't quite stop the users changing the tabs.  What it does do is detect the tab change and stores the initial tab.  Then it checks an allowed flag.  If this allowed flag is set to true (i.e. the change was caused by the button click) then the change happens, if the allowed flag is false, it changes the tab back to the original value.

If you want any furthur information, leave a comment.

BigMadDrongo
0
 
LVL 3

Expert Comment

by:d4jaj1
ID: 1344345
PageControl doesn't 'really' do what he wants either.  You CAN make a specific tab or page invisible using Page Control, however, you can't disable the tab, e.g., make the text light grey.  Maybe someone created a customer component to do this.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 4

Expert Comment

by:itamar
ID: 1344346
Hi Aztec,

If you re-opens the question I know of a TabControl that does excatly what you want and more...

0
 
LVL 4

Expert Comment

by:itamar
ID: 1344347
Just forgot to say: it's shareware (about $40).
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1344348
Yep, there are customer components...
0
 

Author Comment

by:aztec
ID: 1344349
Works great...thanks!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

916 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question