Welcome, Guest. Please login or register.

Author Topic: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE  (Read 1272 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
While processing IDCMPUPDATE messages I'm checking the taglist on IAdress. Then process the DTA_Sync tag to be able to update a datatype after loading it to a window (RefreshDtObjectA()), so that the window display is updated automatically.

However let's suppose I load various user defined (through requesters) datatypes to a window. How do I know to which datatype a given DTA_Sync corresponds to ? I tried to look for DTA_Handle tag in the taglist on IAdress but it's not included ...

\\"We made Amiga, they {bleep}ed it up\\"
 

Online Thomas

Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #1 on: April 09, 2009, 09:07:56 AM »

Quote
How do I know to which datatype a given DTA_Sync corresponds to ? I tried to look for DTA_Handle tag in the taglist on IAdress but it's not included ...


GA_ID should be included. If you add GA_ID with a unique ID to the NewDTObject call, you should be able to identify the object by that ID when receiving an IDCMP_IDCMPUPDATE message.

Bye,
Thomas

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #2 on: April 09, 2009, 05:00:42 PM »
@Thomas
Hey, thanks a bunch. But I'm finding that method not very practical. GA_ID only uses 2 bytes of size meaning I can't put my datatype handle in there directly. So I'd have to wonder through the window's gadget list till I find a particular ID... Even then I'd still have to get the datatype handle from the gadget structure...
I thought about using GA_UserData but it doesn't show up in the IDCMPUPDATE message....

Of course, I could dynamically build my own list of datatypes with their IDs, I just thought there was a more practical way to do it...

Cheers
José
\\"We made Amiga, they {bleep}ed it up\\"
 

Online Thomas

Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #3 on: April 09, 2009, 05:21:52 PM »


Quote
So I'd have to wonder through the window's gadget list till I find a particular ID...


You could hold the object pointers in an array and use the ID as an index to the array.

Code: [Select]

obj_ptrs[id] = NewDTObject (...,GAD_ID,id,...);
id ++;


Quote
Even then I'd still have to get the datatype handle from the gadget structure...


The gadget structure *is* the datatype handle.

Bye,
Thomas

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #4 on: April 09, 2009, 05:45:25 PM »
"The gadget structure *is* the datatype handle."

Aha! Good. I said that cause the datatypes handle is declared as an APTR in the docs so I thought it was supposed to be considered a black box (i.e. don't toutch and all of that...).
\\"We made Amiga, they {bleep}ed it up\\"
 

Online Thomas

Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #5 on: April 09, 2009, 06:09:44 PM »

Quote
I said that cause the datatypes handle is declared as an APTR in the docs so I thought it was supposed to be considered a black box


It *is* considered a black box. But if you think about how BOOPSI works and know that datatpyes are subclasses of gadget class, then there is no other way than that the datatype object pointer points to a struct Gadget.

The array method is better (more "legal"), though.

Bye,
Thomas

Offline JoseTopic starter

  • Hero Member
  • *****
  • Join Date: Feb 2002
  • Posts: 2869
    • Show only replies by Jose
Re: Getting datatype handle from DTA_Sync message on IDCMP_IDCMPUPDATE
« Reply #6 on: April 10, 2009, 02:40:09 PM »
Something I want to share. Been fiddling with the the tags received in IDCMPUPDATE messages and found that for datatypes the address is in DTA_Data!!!!!
Yeah baby!!
There had to be an easier way... :-D

Cheers
\\"We made Amiga, they {bleep}ed it up\\"