comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » widget_tab: prevent switching?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: widget_tab: prevent switching? [message #64114 is a reply to message #63981] Wed, 26 November 2008 09:20 Go to previous messageGo to previous message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Nov 26, 9:16 am, Justus Skorps <ju...@gmx.de> wrote:
> Hi all,
>
> in my GUI I have an widget_tab with different tabs, each containing
> only a widget_base with a widget_draw. I need a possibility to
> temporary prevent to switch to another tab without disabling the
> widget_draw on the current tab. Disabling the whole widget_tab
> prevents switching but also disables button_events from the
> widget_draw of the current tab. The only workaround I found so far
> (switch back to the current tab when a tab event occurs) leads to some
> other problems and a lot of code work...
>
> I also tried to disable the bases of each tabs or set the tab_mode to
> 0, nothing works...
>
> Anyone knows a way to prevent the switching?
>
> thanx,
> Justus

Ok, this is the least inelegant solution I've come up with so far. It
effectively switches back to the current tab when a tab event occurs
while the tab is locked - which was your original workaround. Making
use of the tab widget's own uvalue to store info about current and
locked tabs makes it a managable enough proposition, in my opinion.

PRO TabTest_Tab_Dispatch, Event
Widget_Control, Event.ID, Get_UValue = TabInfo
If TabInfo.Locked Then $
Widget_Control, Event.ID, Set_Tab_Current = TabInfo.Current $
Else Begin
Case Event.Tab of
0:
1:
2: Begin
; Lock this tab
TabInfo.Current = 2L
TabInfo.Locked = 1
Widget_Control, Event.ID, Set_UValue = TabInfo
Widget_Control, UVal.Draw2, Sensitive = 1
; Do some stuff and switch TabInfo.Locked back to 0
; when it's safe to reactivate the tabs
End
EndCase
EndElse
END

PRO TabTest_Done, Event
Widget_Control, Event.Top, Get_UValue = UVal
; Desensitize draw widget
Widget_Control, UVal.Draw2, Sensitive = 0
; Unlock tab widget
Widget_Control, UVal.Tab, Get_UValue = TabInfo
TabInfo.Locked = 0
Widget_Control, UVal.Tab, Set_UValue = TabInfo
END

PRO Tabtest_Foo, Event
Print, 'Event Generated'
END

PRO TabTest

TLB = Widget_Base(Col = 1)
Tab = Widget_Tab(TLB, $
Event_Pro = 'TabTest_Tab_Dispatch', $
UVALUE = {Current : 0L, Locked : 0} )

Base0 = Widget_Base(Tab)
Draw0 = Widget_Draw(Base0, XSize = 200, YSize = 200, $
/Button_Events, Event_Pro = 'Tabtest_Foo')

Base1 = Widget_Base(Tab)
Draw1 = Widget_Draw(Base1, XSize = 200, YSize = 200, $
/Button_Events, Event_Pro = 'Tabtest_Foo')

Base2 = Widget_Base(Tab)
Draw2 = Widget_Draw(Base2, XSize = 200, YSize = 160, $
/Button_Events, Event_Pro = 'Tabtest_Foo')
Btn = Widget_Button(Base2, Value = 'Done', $
Event_Pro = 'TabTest_Done')

Widget_Control, TLB, /Realize
UVal = { Tab : Tab, $
Draw2 : Draw2 }
Widget_Control, TLB, Set_UValue = UVal

XManager, 'TabTest', TLB

END
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: widget_tab
Next Topic: Map project NEXRAD 3 data..

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 17:42:23 PDT 2025

Total time taken to generate the page: 0.63840 seconds