Can't get LBNCA_Integer value (aka I'm too stupid to do it)

3 posts / 0 new
Last post
jabirulo
jabirulo's picture
Offline
Last seen: 4 weeks 1 day ago
Joined: 2013-05-30 00:53
Can't get LBNCA_Integer value (aka I'm too stupid to do it)

Hi just created a listbrowser with 3 columns (Month, Day, Text), but I'm not able to get Month and Day values with GetListBrowserNodeAttrs() I know is somethig with pointers/LBNCA_Integer (* int32), but did some test, but none of them showed Month/Day correctly :-(
Someone more clever than my can help?

TIA

  1. ..
  2. case GID_LISTBROWSER:
  3. IIntuition->GetAttr(LISTBROWSER_SelectedNode, OBJ(GID_LISTBROWSER), (uint32 *)&res_node);
  4. if(res_node)
  5. {
  6. int32 month, day;
  7. IListBrowser->GetListBrowserNodeAttrs( (struct Node *)res_node,
  8. LBNA_Column,0, LBNCA_Integer,(int32 *)&month,
  9. LBNA_Column,1, LBNCA_Integer,(int 32*)&day,
  10. LBNA_Column,2, LBNCA_Text,&res_text, TAG_END);
  11. IDOS->Printf("GET listbrowser's entry data: MM=%ld DD=%ld '%s'\n",&month,&day,res_text);
  12. }
  13. break;
  14. ..
salass00
salass00's picture
Offline
Last seen: 6 months 3 weeks ago
Joined: 2011-02-03 11:27
Change the code to this and

Change the code to this and it should print the right values:

  1. case GID_LISTBROWSER:
  2. IIntuition->GetAttr(LISTBROWSER_SelectedNode, OBJ(GID_LISTBROWSER), (uint32 *)&res_node);
  3. if(res_node)
  4. {
  5. int32 *month = NULL, *day = NULL;
  6. IListBrowser->GetListBrowserNodeAttrs( (struct Node *)res_node,
  7. LBNA_Column,0, LBNCA_Integer,&month,
  8. LBNA_Column,1, LBNCA_Integer,&day,
  9. LBNA_Column,2, LBNCA_Text,&res_text, TAG_END);
  10. if (month && day)
  11. IDOS->Printf("GET listbrowser's entry data: MM=%ld DD=%ld '%s'\n",*month,*day,res_text);
  12. }
  13. break;

The LBNCA_Integer tag gets and sets a pointer to the integer value, not the integer value itself which is why it has to be done like above.

jabirulo
jabirulo's picture
Offline
Last seen: 4 weeks 1 day ago
Joined: 2013-05-30 00:53
YES!!! THX a lot!!!!

YES!!!
THX a lot!!!!

AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P

Log in or register to post comments