Discussion:
Executing Code On Tab Panel Change - BEFORE IT CHANGES!
Kimball Larsen
2005-04-28 06:24:13 UTC
Permalink
This may have been discussed before, but more attention can't hurt,
right?

I have a preferences screen that I have built from scratch. This
screen is composed of a tab panel with several tabs for various
categories of preferences that the user needs to set. I want to force
the user to save preferences before they switch from one tab to
another, and I have provided a "Save" button for this purpose. I do
not want to automatically save the preferences as they modify them for
other reasons not worth getting into here.

When any value in the preferences window is modified, a flag is set to
true that indicates the prefs need to be saved.

In the change() event of the tabPanel, I have added some code that
warns the user they need to save the prefs before continuing on to the
next tab. However, the change() event seems to fire AFTER the change
actually takes place. Thus, behind my alert, the tab they have changed
TO is visible, not the one they have changed FROM. So, when I warn
them that they have made changes in tab A, they are looking (in the
background) at tab B already, as the panel has already moved along to
the next tab.

Short of some really nasty and rather convoluted variables that are
used to switch back to the previous tab (which means tracking the
previous tab) momentarily so it appears to the user that they are still
on the first tab, what can I do to detect the tab has switched?

I've also considered detecting mouse up events that happen over the
tabs themselves, in the hopes that mouseUp is handled before the
change() is fired.

Any ideas would be great.

-- Kimball

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Sean Arney
2005-04-28 07:11:42 UTC
Permalink
Post by Kimball Larsen
Any ideas would be great.
In the spirit that any ideas would be great - can't you just run a modal
dialog at the beginning of the tab controls change event? I do a similar
thing where I have an Apply button that lets the user set and try DB
settings and ping the DB over and over until they get it right - also it
writes prefs whenever the user changes tabs. Seems to work like you are
describing. Try right in the start of the change tab event, For some of my
apps prefs, I use the 'apply' method when they enter text in a box, check a
check box, switch tabs, etc...it shouldn't be any different to defer some
writes to prefs and not others.

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Kimball Larsen
2005-04-28 14:36:52 UTC
Permalink
Post by Sean Arney
Post by Kimball Larsen
Any ideas would be great.
In the spirit that any ideas would be great - can't you just run a modal
dialog at the beginning of the tab controls change event?
That is precisely what I am doing. The very first line of the change
event is my check/alert to the user that they need to save.
However, the tab panel that you can see behind the modal alert has
already changed to the new tab. Thus, my alert says something to the
effect of "Hey, you didn't save all the stuff you changed in this tab,
you want to save it?", and they can see (in the background, behind the
modal dialogue) the NEW tab they just switched to, not the OLD tab
where they made the changes. This makes it look like I've already
gone ahead and switched tabs on them, and they just have to remember
what they may or may not have changed in the previous tab.

-- Kimball

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Sean Arney
2005-04-28 18:56:53 UTC
Permalink
Post by Kimball Larsen
That is precisely what I am doing. The very first line of the change
event is my check/alert to the user that they need to save.
However, the tab panel that you can see behind the modal alert has
already changed to the new tab. Thus, my alert says something to the
effect of "Hey, you didn't save all the stuff you changed in this tab,
you want to save it?", and they can see (in the background, behind the
modal dialogue) the NEW tab they just switched to, not the OLD tab
where they made the changes. This makes it look like I've already
gone ahead and switched tabs on them, and they just have to remember
what they may or may not have changed in the previous tab.
Yes, I tried it and now I see what you mean. I bet that's why I changed to
an automatic save of the values and an Apply button to write them out. (My
tab panel is a prefs dialog) Im going to try a few things... Let me know and
I'll do the same - I can see needing/wanting this too.

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Carlos
2005-04-28 19:15:19 UTC
Permalink
Kimball,

Why don't you just "force" the view of the tab you want users to
decide if they want to save or not?

You could set a NeedToSaveTab flag property as an integer and the
default value would be for example -1.
Then when you check the user make some modifications on a tab, set
this flag with the tab value.

On the Change event you could use something like:

Dim ChangedToTab As Integer
ChangedToTab = Me.Value // the tab user just clicked

If NeedToSaveTab <> - 1 AND NeedToSaveTab <> ChangedToTab Then

// For Tab 0
If NeedToSaveTab = 0 Then
Me.Value = NeedToSaveTab // force the view for tab 0

// Show the dialog alert/save box and perform accordingly
// for tests - it should be a dialog
MsgBox "Hey, you need to save"

End If


// For Tab 1
If NeedToSaveTab = 1 Then
Me.Value = NeedToSaveTab // force the view for tab 1

// Show the dialog alert/save box and perform accordingly
// for tests - it should be a dialog
MsgBox "Hey, you need to save"

End If

// Set the default value of the flag
NeedToSaveTab = - 1

// Then just set the view to the ChangedToTab value
Me.Value = ChangedToTab


End If

---

I tested this with two tabs, each one with an editfield that had
NeedToSaveTab = TabPanel1.Value
on the TextChange event and it worked fine.

Carlos
Post by Kimball Larsen
That is precisely what I am doing. The very first line of
the change
event is my check/alert to the user that they need to save.
However, the tab panel that you can see behind the modal alert has
already changed to the new tab. Thus, my alert says
something to the
effect of "Hey, you didn't save all the stuff you changed
in this tab,
you want to save it?", and they can see (in the background,
behind the
modal dialogue) the NEW tab they just switched to, not the OLD tab
where they made the changes. This makes it look like I've already
gone ahead and switched tabs on them, and they just have to
remember
what they may or may not have changed in the previous tab.
-- Kimball
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Charles Yeomans
2005-04-28 19:25:41 UTC
Permalink
Post by Kimball Larsen
This may have been discussed before, but more attention can't hurt,
right?
I have a preferences screen that I have built from scratch. This
screen is composed of a tab panel with several tabs for various
categories of preferences that the user needs to set. I want to force
the user to save preferences before they switch from one tab to
another, and I have provided a "Save" button for this purpose. I do
not want to automatically save the preferences as they modify them for
other reasons not worth getting into here.
When any value in the preferences window is modified, a flag is set to
true that indicates the prefs need to be saved.
In the change() event of the tabPanel, I have added some code that
warns the user they need to save the prefs before continuing on to the
next tab. However, the change() event seems to fire AFTER the change
actually takes place. Thus, behind my alert, the tab they have
changed TO is visible, not the one they have changed FROM. So, when I
warn them that they have made changes in tab A, they are looking (in
the background) at tab B already, as the panel has already moved along
to the next tab.
Short of some really nasty and rather convoluted variables that are
used to switch back to the previous tab (which means tracking the
previous tab) momentarily so it appears to the user that they are
still on the first tab, what can I do to detect the tab has switched?
I've also considered detecting mouse up events that happen over the
tabs themselves, in the hopes that mouseUp is handled before the
change() is fired.
Any ideas would be great.
Implement your dialog in the MouseDown event handler. Return true if
you want to prevent the change.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 19:44:21 UTC
Permalink
Post by Charles Yeomans
Post by Kimball Larsen
Any ideas would be great.
Implement your dialog in the MouseDown event handler. Return true if
you want to prevent the change.
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Sean Arney
2005-04-28 20:11:43 UTC
Permalink
Post by Norman Palardy
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.
I actually was just moving along Charles method and found this to be an
issue - as well as it being clicked anywhere in the panel, so you get into
the x,y testing bit, right? So, cant you just subclass the tab panel and
override the change event to run a MessageDialog? Then how would you
trigger the parent change event?

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 20:26:21 UTC
Permalink
Post by Sean Arney
Post by Norman Palardy
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.
I actually was just moving along Charles method and found this to be an
issue - as well as it being clicked anywhere in the panel, so you get into
the x,y testing bit, right?
Right ... but ... try this ... make a new project and put a tab panel
on it with 2 tabs ("tab 0" and "some really long tab name")
Make the tab panel 200 pixels wide
The X test is a little weird to figure out in a general way because you
don't know the width of the each tab.
In this set up trying to calculate where the tabs are is tough.
If you change "some really long tab name" to "tab 1" the overall
appearance changes and again figuring out if the X is on a tab is hard
to get in the general case.

You COULD do it for a specific case though as long as the tabs don't
change at run time.
Post by Sean Arney
So, cant you just subclass the tab panel and override the change event
to run a MessageDialog?
Yes, you could.
Or to provide a new "Before change event" and then you can reuse it and
have access to the event and halt the change from occurring.
Post by Sean Arney
Then how would you trigger the parent change event?
In the sub class you wouldn't need to as you could just use the Change
that exists in the subclass

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Kimball Larsen
2005-04-28 20:53:07 UTC
Permalink
Post by Norman Palardy
Post by Sean Arney
Post by Norman Palardy
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.
I actually was just moving along Charles method and found this to be an
issue - as well as it being clicked anywhere in the panel, so you get into
the x,y testing bit, right?
Right ... but ... try this ... make a new project and put a tab panel
on it with 2 tabs ("tab 0" and "some really long tab name")
Make the tab panel 200 pixels wide
The X test is a little weird to figure out in a general way because
you don't know the width of the each tab.
In this set up trying to calculate where the tabs are is tough.
If you change "some really long tab name" to "tab 1" the overall
appearance changes and again figuring out if the X is on a tab is hard
to get in the general case.
You COULD do it for a specific case though as long as the tabs don't
change at run time.
Post by Sean Arney
So, cant you just subclass the tab panel and override the change
event to run a MessageDialog?
Yes, you could.
Or to provide a new "Before change event" and then you can reuse it
and have access to the event and halt the change from occurring.
This sounds promising... but I am unfamiliar with how to add a new
custom event. Is there some good documentation laying around I can dig
up?

Thanks!

-- Kimball

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 20:59:00 UTC
Permalink
Post by Kimball Larsen
This sounds promising... but I am unfamiliar with how to add a new
custom event. Is there some good documentation laying around I can
dig up?
I'll send an example to you offline

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Carlos
2005-04-28 21:28:19 UTC
Permalink
Post by Norman Palardy
Post by Kimball Larsen
This sounds promising... but I am unfamiliar with how to
add a new custom event. Is there some good
documentation laying around I can dig up?
I'll send an example to you offline
Norman,
Can you please send it to me also?

Thanks,
Carlos

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Charles Yeomans
2005-04-28 20:45:05 UTC
Permalink
Post by Sean Arney
Post by Norman Palardy
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.
I actually was just moving along Charles method and found this to be an
issue - as well as it being clicked anywhere in the panel, so you get into
the x,y testing bit, right? So, cant you just subclass the tab panel and
override the change event to run a MessageDialog? Then how would you
trigger the parent change event?
You wouldn't. The Change event handler is called in the course of the
TabPanel code that changes the TabPanel. Kimball's problem is that he
needs to do something before the change is initiated, and I think that
the MouseDown event handler is the place to do it. I overlooked the
need to determine the location of the mouse click, but that shouldn't
be too hard, I think.


--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Kimball Larsen
2005-04-28 20:51:54 UTC
Permalink
Post by Charles Yeomans
Post by Sean Arney
Post by Norman Palardy
Probably need to do some work to make sure that the tab has been
clicked in the area where a tab change would be triggered.
Otherwise clicking anywhere on the tab would bring up the prompt as
though they were changing tabs which might not be desirable.
I actually was just moving along Charles method and found this to be an
issue - as well as it being clicked anywhere in the panel, so you get into
the x,y testing bit, right? So, cant you just subclass the tab panel and
override the change event to run a MessageDialog? Then how would you
trigger the parent change event?
You wouldn't. The Change event handler is called in the course of the
TabPanel code that changes the TabPanel. Kimball's problem is that he
needs to do something before the change is initiated, and I think that
the MouseDown event handler is the place to do it. I overlooked the
need to determine the location of the mouse click, but that shouldn't
be too hard, I think.
Charles is right on here, and earlier today I decided that I think this
will be the best approach for a few reasons: It is easy to implement
(my tabs are not dynamic) and based on some simple tests I slapped
together, this will work correctly. However, I am not happy with as it
feels like a kludge to me. Anytime I have to make the application
behave a certain way based on the pixel coordinates on a standard
control just feels clunky to me.

Thanks for all the feedback!

-- Kimball


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 20:57:54 UTC
Permalink
Post by Charles Yeomans
You wouldn't. The Change event handler is called in the course of the
TabPanel code that changes the TabPanel. Kimball's problem is that he
needs to do something before the change is initiated, and I think that
the MouseDown event handler is the place to do it. I overlooked the
need to determine the location of the mouse click, but that shouldn't
be too hard, I think.
The mouse down works very well IF we can figure out whether the click
was or was not on a tab

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Charles Yeomans
2005-04-28 21:17:57 UTC
Permalink
Post by Norman Palardy
Post by Charles Yeomans
You wouldn't. The Change event handler is called in the course of
the TabPanel code that changes the TabPanel. Kimball's problem is
that he needs to do something before the change is initiated, and I
think that the MouseDown event handler is the place to do it. I
overlooked the need to determine the location of the mouse click, but
that shouldn't be too hard, I think.
The mouse down works very well IF we can figure out whether the click
was or was not on a tab
I suppose on each panel you could put a Canvas that covers all but the
tabs. The Canvas would catch clicks on it, and clicks that make it to
the TabPanel might be deemed to be attempts to switch the panel.

Probably what would be best would be a feature request for an event
Changing() as Boolean.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Adam Ernst
2005-04-28 21:30:02 UTC
Permalink
How about making the "Change" event return a boolean, and add a
parameter "oldTab"? You could return true if you didn't want the change
to occur. It wouldn't break existing code, since the absence of a
return statement automatically returns false. And we wouldn't need a
new event.

Adam
Post by Charles Yeomans
Probably what would be best would be a feature request for an event
Changing() as Boolean.
--------------
Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Charles Yeomans
2005-04-28 22:13:47 UTC
Permalink
There are two states here -- the panel is about to change, and the
panel has changed. Two events, as I suggest, give clear access to each
state.

--------------
Charles Yeomans
Post by Adam Ernst
How about making the "Change" event return a boolean, and add a
parameter "oldTab"? You could return true if you didn't want the
change to occur. It wouldn't break existing code, since the absence of
a return statement automatically returns false. And we wouldn't need a
new event.
Adam
Post by Charles Yeomans
Probably what would be best would be a feature request for an event
Changing() as Boolean.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Adam Ernst
2005-04-28 22:46:42 UTC
Permalink
True. You are right.

Adam
Post by Charles Yeomans
There are two states here -- the panel is about to change, and the
panel has changed. Two events, as I suggest, give clear access to
each state.
--------------
Charles Yeomans
Post by Adam Ernst
How about making the "Change" event return a boolean, and add a
parameter "oldTab"? You could return true if you didn't want the
change to occur. It wouldn't break existing code, since the absence
of a return statement automatically returns false. And we wouldn't
need a new event.
Adam
Post by Charles Yeomans
Probably what would be best would be a feature request for an event
Changing() as Boolean.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 23:18:30 UTC
Permalink
Post by Charles Yeomans
There are two states here -- the panel is about to change, and the
panel has changed. Two events, as I suggest, give clear access to
each state.
--------------
Charles Yeomans
Has anyone filed the request ?

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Charles Yeomans
2005-04-28 23:54:10 UTC
Permalink
Post by Norman Palardy
Post by Charles Yeomans
There are two states here -- the panel is about to change, and the
panel has changed. Two events, as I suggest, give clear access to
each state.
--------------
Charles Yeomans
Has anyone filed the request ?
I haven't.

--------------
Charles Yeomans

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-29 00:11:35 UTC
Permalink
Post by Charles Yeomans
I haven't.
I have ... I think it reads right
http://www.realsoftware.com/feedback/viewreport.php?reportid=jfckdeuq

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Sean Arney
2005-04-29 04:06:11 UTC
Permalink
Post by Norman Palardy
I have ... I think it reads right
http://www.realsoftware.com/feedback/viewreport.php?reportid=jfckdeuq
Sounds perfect, I joined it.

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-29 04:24:08 UTC
Permalink
Post by Sean Arney
Post by Norman Palardy
I have ... I think it reads right
http://www.realsoftware.com/feedback/viewreport.php?reportid=jfckdeuq
Sounds perfect, I joined it.
I think there is a whole host of "before" kinds of events that could be
added to many controls to be able to intercept and stop a Change, etc
from happening without being validated.

Some I think we can add by ourselves in subclasses (although I have to
admit I have not checked all controls for this)

But there are some, like the tab panel and perhaps the page panel,
where we can only get close but not quite and that REAL would need to
pass to us to make work properly.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Sean Arney
2005-04-29 04:36:26 UTC
Permalink
Its really just missing a way to know if the click was on the tab or not -
so maybe a tabClicked event or something. Anyway, as usual, thanks for the
help Norm and thanks for filling out the FR.

-seanA


Norman Palardy
Post by Norman Palardy
Post by Sean Arney
Post by Norman Palardy
I have ... I think it reads right
http://www.realsoftware.com/feedback/viewreport.php?reportid=jfckdeuq
Sounds perfect, I joined it.
I think there is a whole host of "before" kinds of events that could be
added to many controls to be able to intercept and stop a Change, etc
from happening without being validated.
Some I think we can add by ourselves in subclasses (although I have to
admit I have not checked all controls for this)
But there are some, like the tab panel and perhaps the page panel,
where we can only get close but not quite and that REAL would need to
pass to us to make work properly.
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Tom Benson
2005-04-29 04:46:23 UTC
Permalink
I've faked this (I know it's not a great solution....) by having only
the headers of a tab panel visible, over the top of a pagepanel. When
the tab is changed, I execute the code I want to occur at "Changing"
and then I change the value of the pagepanel to equal the value of the
tab panel. A hack, but it works fine.

Cheers,
Tom
-----------------------------------------------
The problems that exist in the world today cannot be solved by the
level of thinking that created them.
--Albert Einstein
Post by Sean Arney
Its really just missing a way to know if the click was on the tab or not -
so maybe a tabClicked event or something. Anyway, as usual, thanks for the
help Norm and thanks for filling out the FR.
-seanA
Norman Palardy
Post by Norman Palardy
Post by Sean Arney
Post by Norman Palardy
I have ... I think it reads right
http://www.realsoftware.com/feedback/viewreport.php?
reportid=jfckdeuq
Sounds perfect, I joined it.
I think there is a whole host of "before" kinds of events that could be
added to many controls to be able to intercept and stop a Change, etc
from happening without being validated.
Some I think we can add by ourselves in subclasses (although I have to
admit I have not checked all controls for this)
But there are some, like the tab panel and perhaps the page panel,
where we can only get close but not quite and that REAL would need to
pass to us to make work properly.
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Sean Arney
2005-04-28 21:03:00 UTC
Permalink
Post by Charles Yeomans
You wouldn't. The Change event handler is called in the course of the
TabPanel code that changes the TabPanel. Kimball's problem is that he
needs to do something before the change is initiated, and I think that
the MouseDown event handler is the place to do it. I overlooked the
need to determine the location of the mouse click, but that shouldn't
be too hard, I think.
Youre right Charles it does occur before you have the chance to get in front
of it - the mouse down does definitely do it, but seems kind of hacky for my
particlur case. In my case that would be brutal because the tab names are
user defined based on their own database column names. So the hunt for the
mouse clicked in the actual tabs part of the panel is a moving target...

Norm, please do send me the example to me as well - I have a class subbed
from TabPanel with a new event but how do you get it to occur before the
'real' one does?

-seanA


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Norman Palardy
2005-04-28 21:40:14 UTC
Permalink
Post by Sean Arney
Post by Charles Yeomans
You wouldn't. The Change event handler is called in the course of the
TabPanel code that changes the TabPanel. Kimball's problem is that he
needs to do something before the change is initiated, and I think that
the MouseDown event handler is the place to do it. I overlooked the
need to determine the location of the mouse click, but that shouldn't
be too hard, I think.
Youre right Charles it does occur before you have the chance to get in front
of it - the mouse down does definitely do it, but seems kind of hacky for my
particlur case. In my case that would be brutal because the tab names are
user defined based on their own database column names. So the hunt for the
mouse clicked in the actual tabs part of the panel is a moving
target...
Norm, please do send me the example to me as well - I have a class subbed
from TabPanel with a new event but how do you get it to occur before the
'real' one does?
you "hack" it by hooking into the mouse down and calling your new event
from there and returning an appropriate boolean depending on if you
want the change to be allowed or not.

No other way I know of

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Gerd Wilmer
2005-04-28 21:54:59 UTC
Permalink
I would approach it differently from the other responses
I understand that you only want to revert to the last TabPanel if
changes have not been saved.
1) create a (hidden) StaticText, set the default state to 0
2) create a subclass of Editfield for all Editfields in your window
use the TextChange event to set the StaticText to the current
TabPanel.Listindex
3) your Save button resets StaticText to 0
4) when changing TabPanels check whether StaticText = 0
if not send your warning and send the user back to
TabPanel.Listindex = val(StaticTExt.text)


Gerd Wilmer
Post by Kimball Larsen
This may have been discussed before, but more attention can't hurt,
right?
I have a preferences screen that I have built from scratch. This
screen is composed of a tab panel with several tabs for various
categories of preferences that the user needs to set. I want to force
the user to save preferences before they switch from one tab to
another, and I have provided a "Save" button for this purpose. I do
not want to automatically save the preferences as they modify them for
other reasons not worth getting into here.
When any value in the preferences window is modified, a flag is set to
true that indicates the prefs need to be saved.
In the change() event of the tabPanel, I have added some code that
warns the user they need to save the prefs before continuing on to the
next tab. However, the change() event seems to fire AFTER the change
actually takes place. Thus, behind my alert, the tab they have
changed TO is visible, not the one they have changed FROM. So, when I
warn them that they have made changes in tab A, they are looking (in
the background) at tab B already, as the panel has already moved along
to the next tab.
Short of some really nasty and rather convoluted variables that are
used to switch back to the previous tab (which means tracking the
previous tab) momentarily so it appears to the user that they are
still on the first tab, what can I do to detect the tab has switched?
I've also considered detecting mouse up events that happen over the
tabs themselves, in the hopes that mouseUp is handled before the
change() is fired.
Any ideas would be great.
-- Kimball
_______________________________________________
<http://www.realsoftware.com/support/listmanager/>
<http://support.realsoftware.com/listarchives/lists.html>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
Loading...