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 
Switch to threaded view of this topic Create a new topic Submit Reply
widget_tab: prevent switching? [message #63981] Wed, 26 November 2008 01:16 Go to next message
Justus Skorps is currently offline  Justus Skorps
Messages: 20
Registered: April 2007
Junior Member
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
Re: widget_tab: prevent switching? [message #64068 is a reply to message #63981] Fri, 28 November 2008 00:50 Go to previous messageGo to next message
Justus Skorps is currently offline  Justus Skorps
Messages: 20
Registered: April 2007
Junior Member
Thx for your answer Chris. But this also leaves me with a bunch of new
code which makes my program even more confusing. Switching between
tabs is always not simple because I always have to adjust the values
of some buttons, maintain the zoom history of the current tabs, ... .
And of course I do not want to to all this just to switch back because
the switching should have been forbidden...but I guess there is no
"nice" way...I should have expect this from IDL...the more time I
spent with this s### the more I hate it...
Re: widget_tab: prevent switching? [message #64113 is a reply to message #63981] Wed, 26 November 2008 09:27 Go to previous messageGo to next message
Spon is currently offline  Spon
Messages: 178
Registered: September 2007
Senior Member
On Nov 26, 5:20 pm, Spon <christoph.b...@gmail.com> wrote:
>     Base2 = Widget_Base(Tab)

Sorry, this should be a row/column base if you want your button to
appear

Base2 = Widget_Base(Tab, /Col)
Re: widget_tab: prevent switching? [message #64114 is a reply to message #63981] Wed, 26 November 2008 09:20 Go to previous messageGo to next 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
Re: widget_tab [message #64242 is a reply to message #63981] Thu, 11 December 2008 08:09 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
steverajiv writes:

> Is there any way to change the order of tabs using widget_control or
> widget_info (e.g., swap tab1 and tab2 etc..)

I don't think there is any way to change the order of the
tabs. I suppose you could try rebuilding them in a different
order, but it hardly seems worth the effort.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: widget_tab
Next Topic: Map project NEXRAD 3 data..

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

Current Time: Wed Oct 08 19:04:45 PDT 2025

Total time taken to generate the page: 0.00703 seconds