User-agent: Mozilla Thunderbird 1.0.6 (Macintosh/20050716)
I have a carbonised application that still uses wait next event. I want
to bring in some of the dialogs to nib entries rather than resources.
The application opens large files with a custom RLE compression. These
files can be as large as a quarter gigabyte or more when uncompressed.
During the file open, I was displaying a custom progress bar using
Quickdraw calls, to extend a 50% gray line into a custom object in the
dialog.
Using sample code I got here a few weeks back, I re-wrote the progress
dialog to use HIView calls. I get the dialog which shows up not
highlighted. My calls to SetControl32BitValue are not causing any
update to the bar in the dialog. It always looks un selected. No
progress is indicated
The application (Which is huge and I am the only maintainer) uses
Waitnextevent as noted above. Converting to
RunApplicationEventLoop(); is not an option as this would mean
re-writing more than I have time for. I would prefer to incrementally
re-write the app, with the sections that were working left alone.
Even if I was running an application loop, The file load code is a tight
loop that handles the loading of the large data set, Which is made from
compressed tiles of the large background image.
What I think I need is a call like the QDFlushPortBuffer that made the
quickdraw progress bar work. A command to force a window update NOW!!.
I tried to use UpdateControls, but the bar still remains grayed out.
Here is the code with the old quickdraw calls ifdefed out.
segment size increments inside the preflight routine.
<code>
SetCursor(*GetCursor(watchCursor)); // set the cursor
to a watch while busy
err = CreateNibReference(CFSTR("main"), &nibRef);
//require_noerr( err, CantGetNibRef );
if(err==noErr)
{
err = CreateWindowFromNib(nibRef, CFSTR("load progress"),
&Progdialog);
//require_noerr( err, CantCreateWindow );
if(err==noErr)
{
DisposeNibReference(nibRef);
//RegisterForEvents(Progdialog);
InstallStandardEventHandler(GetWindowEventTarget(Progdialog)); /*
installs the default windows handler */
}
}
if (Progdialog != nil)
{
HIViewRef root = HIViewGetRoot(Progdialog);
if (root != NULL)
{
HIViewID progressID = {'PROG', 128};
HIViewFindByID(root, progressID, &progressBar);
if (progressBar)
{
Boolean indeterminate = false;
SetControlData(progressBar, kControlEntireControl,
kControlProgressBarIndeterminateTag,
sizeof(Boolean), &indeterminate);
if (indeterminate)
{
Boolean animate = true;
SetControlData(progressBar, kControlEntireControl,
kControlProgressBarAnimatingTag,
sizeof(Boolean), &animate);
}
}
}
}
/* code to open file is here ... */
/* on succesful file open and more error checking we display the
progress window */
/* update progress window */
SetControl32BitMaximum(progressBar,(SInt32)fileSize);
bar = oldbar = 0;
ShowWindow(Progdialog);
/*the above fragment is part of the load loop gets called here ... */
</code>
A check using GetControl32BitValue shows the control value being
updated, there is just no action on the screen, until the file loads.
-julie
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden