How to activate tab view and progress bar in it?

Hi,

This has been a persistent problem so I hope someone out there could give me a hand on this. I actually searched this forum for relevant posts but found none that effectively does what I want. BTW, why is the Google search gone from this forum? Just wondering…

I have an application that has a tab view which contains a progress bar. When I activate the tab view and tell the progress bar to start, nothing happens until I click the window. That’s when the progress bar starts spinning.

I have tried commands (for the lack of good ideas) like activate, set frontmost of application to bring the window up front, etc…no dice! The progress bar just won’t do anything at all until I click the container window. So, there must be something that I need to do to make that window the active window…short of using a GUI to click it programmatically.

So, if I may ask, what is the most effective way to activate my tab view so that the progress bar will start without my clicking directly on the window?

Here’s the codes for the handler that is supposed to activate the progress bar.

on start_progressBar(showThisText)
	tell app "System Events" to set frontmost of process "myApps" to true
	tell window "utilityTools"
		tell tab view "utilityTabs"
			tell current tab view item
				set contents of text field "action_Indicator" to showThisText
				tell progress indicator "myProgressBar"  to start
			end tell
		end tell
	end tell
	return
end start_progressBar

BTW, if it’s of any importance the progress bar is a spinning wheel type.

Thanks for any assistance.

archseed :frowning:

Hi :slight_smile:

To start, I do not know why you placed a “progress indicator” in the “tab view”, it is one rather unusual situation, since, in general, simplest and practical are to place the “progress indicator” in a dedicated window of type “panel”, which is displayed attached to the main window, for example, at the time of executing the associated treatment.

This approach brings at least three advantages:

  1. When the window of “progress indicator” is displayed, the user must await that it is closed to be able to continue to act, this prevents that the user launches other actions during the execution of the associated treatment at the “progress indicator”. Sure and protected treatment …

  2. The “progress indicator” can very easily be used like “indeterminate” or with minimum and maximum values, according to the needs. Simple use and flexible device.

  3. This solution is very simple to set up and it is reusable very easily in the same project or adaptable quickly to any other project. Simple and fast portability…

This being said, in your case, there is perhaps an easy way to use, here a suggestion (not tested):


on start_progressBar(showThisText)
	tell me to activate
	tell window "utilityTools"
		tell tab view "utilityTabs"
			tell current tab view item
				set contents of text field "action_Indicator" to showThisText
				tell progress indicator "myProgressBar"  to start
				call method "animate:" of (progress indicator "myProgressBar")
				-- Or: call method "startAnimation:" of (progress indicator "myProgressBar")
			end tell
		end tell
	end tell
	return
end start_progressBar

:wink:

Hi Fredo,

Thanks for the suggestions. Incidentally, we appear to be hanging together on the same thread…it seems.

I actually posted my problem long ago but nobody came to the rescue so I re-posted it hoping someone would pick it up. Thank God Fredo is there to pick it up.

Indeed, I agree with you that having the progress bar in a panel attached to the window would be a better approach. I wanted to do that before but had problems getting the panel attached. Now that I know how (remember our latest posts?) I should be able to do implement it.

I will also consider to test your “call method” suggestion just in case it might come in handy.

Cheers.

archseed :slight_smile:

Hi Fredo,

FYI, the “call animate:” method did not work for me when I inserted that in my application.

However, I have already started switching the progress bar to an attached panel. That is not a problem. I just have to revise the GUI a little bit and the codes to take care of the modifications.

Thanks for the suggestion.

archseed :slight_smile:

Hi archseed :slight_smile:

Ho… sorry… I did not test…

Perhaps that the Cocoa method rather requires a complete path to the object, out of the “tell” of the object, like this:


call method "animate:" of (progress indicator "myProgressBar" of current tab view item of tab view "utilityTabs" of window "utilityTools")

I do not know if this works, in any case, it is certain that the use of a window dedicated to a “progress indicator” is a solution which avoids this type of problems.

:wink: