Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Any idea about DataBrowser?



On 29/11/2003 01:53, Norio Ota wrote:

> On 2003/11/29, at 7:24, Mike Kluev wrote:
>
>> On 28 Nov 2003 15:18:52, Norio Ota <email@hidden> wrote:
>>
>>> I have a problem with DataBrowser.
>>>
>>> I'm trying to display characters when a databrowser item is clicked.
>>> I used kDataBrowserSelectionSetChanged in ItemNotification callback,
>>> but it didn't work properly when you clicked the same item.
>>
>> When you click the same item the selection is not changed thus you
>> are not getting kDataBrowserSelectionSetChanged notification. What
>> you want looks a bit odd. Try installing kEventControlClick handler
>> on the control target (although that will give you all clicks not
>> only those that target items).
>
> I should have said that my app didn't use carbon event at first.

This is not a problem per se. You may use carbon event handler
in this and only this point leaving the rest of your app unchanged.
That handler can store appropriate information as control property
that you can query later in your app when appropriate.

> I had tried to catch a click on the control, but I wasn't sure if it
> returned which part was clicked.

If you are calling TrackControl/HandleControlClick yourself just
watch what part code it returns. Or check the part code in
kEventControlTrack handler.

> I couldn't find such a suitable tag like content or
> scrollbar.

I guess DB will not report it, but double check.

> Should I calculate which part of the databrowser was clicked from the
> mouse coordination?

Perhaps. This is something kludge that I can think of right now:

- Subscribe to kEventControlClick event on control target.

- CallNextEventHandler.

- If you got kDataBrowserSelectionSetChanged notification
(during the call to CNEH) you are done - nothing else to do.

- If not user clicks somewhere. It could be selected item or
some non-item part of control.

- Lets suppose it is selected item. You know all of them
(by means of GetDataBrowserItems or ForEachDataBrowserItem
with kDataBrowserItemIsSelected flag).

- For each item check if click went to its bounds.
Get item bounds with GetDataBrowserItemPartBounds.
Get click location as event parameter.

- If you found item, store appropriate info about it as
control property.

- Use this property when appropriate.

Now, the real question: what kind of UI force you to do this?

Mike
_______________________________________________
carbon-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/carbon-development
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Any idea about DataBrowser? (From: Norio Ota <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.