i am trying to change the currently displaying tab view item BEFORE i call a function to do some background work. the problem is that the function runs and does the work BEFORE the tab view changes. this leaves interface elements open to the user after the program has gone beyond that point. (BTW, i’m changing tab view items about 10 other time in the course of this program and those all work great)
Here’s the code:
--this is the code i use many times in other places, it works elsewhere tell tab view tabPanelName of window mainWindowName set the current tab view item to tab view item "radmindRunningPanel" end tell --call function to run radmind runRadmind()
the runRadmind() function contains a call to ‘do shell script’ from my last posted problem (graciously answered by jon http://bbs.applescript.net/viewtopic.php?t=8196 )
on runRadmind() set resource_path to (resource path of main bundle) & "/" do shell script (quoted form of (resource_path & iHookEXEPath)) & " " & (quoted form of (resource_path & radmindScriptName)) end runRadmind
this code launches A DIFFERENT cocoa program (called iHook) that lives in the Resources path of my app. Here’s the funny part: if i force quit iHook, the tab panel changes to correct item. weird…so the tab panel will change, but only after the code that follows the call to change is finished.
i’ve tried several things…making a call to the finder to activate (just to give the tab view time to change) that crashed my program.
i’ve tried to use a repeat block:
--loop until the panel is changed repeat until the label of the current tab view item of tab view tabPanelName of window mainWindowName is equal to "radmindRunningPanel" --switch to 'radmind is running' panel tell tab view tabPanelName of window mainWindowName set the current tab view item to tab view item "radmindRunningPanel" end tell end repeat
that also crashed my program. Any suggestions?