Solved

Disabling TabbedNoteBook Tabs...

Posted on 1998-05-11
7
909 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 50 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Industry Leaders: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses
Course of the Month8 days, 4 hours left to enroll

617 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