Re: Live update of NSTextField in tool bar
Re: Live update of NSTextField in tool bar
- Subject: Re: Live update of NSTextField in tool bar
- From: John Nairn <email@hidden>
- Date: Wed, 10 Dec 2003 12:59:20 -0700
I did some tests and windowDidResize is called whenever the window
changes size and thus is called repeatedly during a live resize.
Nevertheless, if that method is used to set the string value of text
fields, the setting works for an NSTextField in the main window, but
not for one in the tool bar. I also noticed more strange behavior:
1. The text fields are showing the size of a plot area. Assume the area
is initially 8 X 5.
2. As I resize the window and use the windowDidResize method to display
the current size in two text fields, the text field in the tool bar
stays at 8X5 while the one in the main window tracks the current size.
Nothing seems to alter this behavior.
3. If I pause the live resize while continuing to hold done the mouse
button. the tool bar field eventually matches the actual size.
4. But if I start to move the mouse again, the tool bar field reverts
to 8 X 5 while the main window field continues to work correctly. This
behavior is strange because the tool bar has never been set to 8 X 5
since the resize began. During the pause it was updated to reflect the
most recent setStringValue, but when motion begins again it must look
up (on its own) the old setting it had before the live resize ever
began and goes back to that setting until the resizing pauses again or
is completed. Why would a control do this?
My conclusion is that an NSTextField in the tool bar can not correctly
track the current state of the window size. My solution has been to
temporarily show a field in the main window during resizing so the user
can adjust the size to any preferred setting in a single resize. It was
easy to bracket the live resize by using the viewWillStartLiveResize
and viewDidEndLiveResize to show and then hidden a text field to
display the size while resizing. The tool bar matches it after the
resizing is done.
On Dec 9, 2003, at 11:00 PM, email@hidden wrote:
>
To be honest, I'm not certain when the windowDidResize method is
>
called... I would intuitively expect it to be called whenever a
>
change is made, even if it is still undergoing resize. It would only
>
take a moment to test, anyway.
>
>
>
On 2003 Dec 09, at 14:04, John Nairn wrote:
>
>
> I don't think that will help. The field updates fine after the resize
>
> is done (isn't that when windowDidResize will occur), but I want it
>
> to update during the live resize. I am setting the string in the
>
> drawRect method of the custom view and that method is called
>
> repeatedly during live resize. This call works fine for a field in
>
> the window (and not part of the custom view), but not for a field in
>
> the tool bar. The field that works is moving during live resize as
>
> well.
>
>
>
> On Dec 9, 2003, at 2:34 PM, Daniel Todd Currie wrote:
>
>
>
>> Have you tried the -windowDidResize: delegate method for NSWindow?
>
>>
>
>> On 2003 Dec 09, at 07:35, John Nairn wrote:
>
>>
>
>>> I currently have an NSTextField that displays size of a custom view
>
>>> which changes while resizing the window. It dynamically shows the
>
>>> size during the resize. I recently decided to add a tool bar to the
>
>>> window and move this field from the bottom of the window to the
>
>>> tool bar (it is in a view that is a tool bar item). It displays the
>
>>> size fine, but does not update while resizing; it only displays the
>
>>> new size after the resize is done. I tried to induce a resize in
>
>>> the drawRect of my custom view with
>
>>>
>
>>> [showSizeField setStringValue:theNewSize];
>
>>> [showSizeField display];
>
>>>
>
>>> but it does not display until the live resize is done.
>
>>>
>
>>> Is there a way to update fields in the tool bar while resizing the
>
>>> window?
>
>>>
------------
John Nairn (1-801-581-3413, FAX: 1-801-581-4816)
Web page:
http://www.eng.utah.edu/~nairn
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.