Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Disabling the changing of tabs in a CTabFolder.
Disabling the changing of tabs in a CTabFolder. [message #444361] Tue, 12 October 2004 02:36 Go to next message
Mark Freiheit is currently offline Mark FreiheitFriend
Messages: 30
Registered: July 2009
Member
I have a CTabItem with some text boxes on it.
I wish to evaluate the contents of these text boxes and deny the user
the ability to select another tab if an IllegalArgumentException is thrown.

I am confused why this code does not work along those lines...

myFolder.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
try {
mySheet.processFields();
} catch (IllegalArgumentException iae) {
event.doit = false;
}
}
});

Is it because the selection has already occurred by the time the selection
listener is notified?
Any ideas what would accomplish my goal?

Thanks -- Mark
Re: Disabling the changing of tabs in a CTabFolder. [message #444423 is a reply to message #444361] Tue, 12 October 2004 15:05 Go to previous messageGo to next message
Richard Moore is currently offline Richard MooreFriend
Messages: 71
Registered: July 2009
Member
Hi,

Try adding the listener to the CTabFolder.. the event source is then the c
tab item

R


"Mark Freiheit" <freiheit@speakeasy.net> wrote in message
news:ckffuv$4hs$1@eclipse.org...
>I have a CTabItem with some text boxes on it.
> I wish to evaluate the contents of these text boxes and deny the user
> the ability to select another tab if an IllegalArgumentException is
> thrown.
>
> I am confused why this code does not work along those lines...
>
> myFolder.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent event) {
> try {
> mySheet.processFields();
> } catch (IllegalArgumentException iae) {
> event.doit = false;
> }
> }
> });
>
> Is it because the selection has already occurred by the time the selection
> listener is notified?
> Any ideas what would accomplish my goal?
>
> Thanks -- Mark
>
Re: Disabling the changing of tabs in a CTabFolder. [message #444425 is a reply to message #444361] Tue, 12 October 2004 15:39 Go to previous messageGo to next message
Veronika Irvine is currently offline Veronika IrvineFriend
Messages: 1272
Registered: July 2009
Senior Member
The selection event is sent after the selection has changed. The event.doit
field is not referenced by CTabFolder. To block the selection change, you
would need to reset the selection to the previous selection (using
CTabFolder.setSelection) in the Selection event handler. You would need to
remember the old selection index since this is no longer available. This
will probably cause some flicker.

"Mark Freiheit" <freiheit@speakeasy.net> wrote in message
news:ckffuv$4hs$1@eclipse.org...
>I have a CTabItem with some text boxes on it.
> I wish to evaluate the contents of these text boxes and deny the user
> the ability to select another tab if an IllegalArgumentException is
> thrown.
>
> I am confused why this code does not work along those lines...
>
> myFolder.addSelectionListener(new SelectionAdapter() {
> public void widgetSelected(SelectionEvent event) {
> try {
> mySheet.processFields();
> } catch (IllegalArgumentException iae) {
> event.doit = false;
> }
> }
> });
>
> Is it because the selection has already occurred by the time the selection
> listener is notified?
> Any ideas what would accomplish my goal?
>
> Thanks -- Mark
>
Re: Disabling the changing of tabs in a CTabFolder. [message #451034 is a reply to message #444425] Tue, 22 February 2005 08:57 Go to previous message
Omry Yadan is currently offline Omry YadanFriend
Messages: 45
Registered: July 2009
Member
It seems like disabling the tab item would do the trick in a cleaner
way, but the enhancment request for it was rejected
(https://bugs.eclipse.org/bugs/show_bug.cgi?id=75050)


Veronika Irvine wrote:
> The selection event is sent after the selection has changed. The event.doit
> field is not referenced by CTabFolder. To block the selection change, you
> would need to reset the selection to the previous selection (using
> CTabFolder.setSelection) in the Selection event handler. You would need to
> remember the old selection index since this is no longer available. This
> will probably cause some flicker.
>
> "Mark Freiheit" <freiheit@speakeasy.net> wrote in message
> news:ckffuv$4hs$1@eclipse.org...
>
>>I have a CTabItem with some text boxes on it.
>>I wish to evaluate the contents of these text boxes and deny the user
>>the ability to select another tab if an IllegalArgumentException is
>>thrown.
>>
>>I am confused why this code does not work along those lines...
>>
>> myFolder.addSelectionListener(new SelectionAdapter() {
>> public void widgetSelected(SelectionEvent event) {
>> try {
>> mySheet.processFields();
>> } catch (IllegalArgumentException iae) {
>> event.doit = false;
>> }
>> }
>> });
>>
>>Is it because the selection has already occurred by the time the selection
>>listener is notified?
>>Any ideas what would accomplish my goal?
>>
>>Thanks -- Mark
>>
>
>
>
Previous Topic:Selected row after remove
Next Topic:canvas scrolling
Goto Forum:
  


Current Time: Thu Apr 25 17:16:18 GMT 2024

Powered by FUDForum. Page generated in 0.03657 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top