24 June 2023, 05:19 | #1 |
Registered User
Join Date: May 2023
Location: Christchurch, New Zealand
Posts: 33
|
LISTVIEW_KIND exec lists
Forgive me but I've clear forgotten how to use this gadget; SASC 6.58, would be good if there was a repository some place with example code on how to do some of these things just as a branching thought.
Code:
struct NewGadget ng; struct List *diskList; if (diskList = AllocMem(sizeof(struct List), MEMF_CLEAR)) { NewList(diskList); } else { printf("Cannot allocate memory for list.\n"); } gad = CreateContext(glistptr); ng.ng_LeftEdge = 4; ng.ng_TopEdge = 4; ng.ng_Width = 200; ng.ng_Height = 200; //ng.ng_GadgetText = "_+"; ng.ng_GadgetID = LV_DISKS; ng.ng_Flags = 0; gad = CreateGadget(LISTVIEW_KIND, gad, &ng, GTLV_ShowSelected, NULL, GTLV_Selected, 0, GTLV_MakeVisible, 0, GTLV_Labels, diskList, TAG_END); |
24 June 2023, 08:47 | #2 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
GTLV_Labels tag is an array of pointers (struct List*[]) and not a single struct List*. Something like:
Code:
struct List lab0 = { ... }; ... struct List lab3 = { ... }; struct List* disklist[4] = { &lab0, ..., &lab3 }; |
24 June 2023, 10:00 | #3 | |
Registered User
Join Date: Jan 2002
Location: Germany
Posts: 7,032
|
Quote:
Your code looks ok. Which version of gadtools.library are you using? The list is completely empty, but you still ask it to select the first entry and make it visible. Maybe you should add some nodes to the list. Or omit these tags until the entry you ask for is actually in the list. There is a rather old example: http://thomas-rapp.homepage.t-online.de/examples/lv.c I don't know if it covers your issue here. |
|
24 June 2023, 13:25 | #4 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,068
|
I meant array of nodes, of course. That should make a little more sense but it's still wrong (struct List* is the correct tag argument).
The problem was my "source of info" (a pretty big and messy one, shouldn't be hard to guess :P) is not using a list header (c equivalent: struct List, with extra type and pad) but a minimal list header (struct MinList, containing only 3 pointers), which is easily mixed up with a pointer array when you have DC.L's. Combined with settings the labels for other gadgets (radio buttons, multi select buttons) that do have a GTXX_Labels pointer array argument... In any case, thanks for correction. |
24 June 2023, 16:02 | #5 | |
Registered User
Join Date: May 2023
Location: Christchurch, New Zealand
Posts: 33
|
Quote:
Yes the list is 'supposed' to be empty for now, program start presents an empty list to be filled by the user later, a collection of disk image(s) names to be exact. -- source code compiles at least had to add a few includes but it runs, now to to discover why it runs. Last edited by Inner200k; 24 June 2023 at 16:13. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
WHDLoad and exec | Radertified | Coders. Asm / Hardware | 2 | 16 August 2021 15:36 |
How to know if user really clicked an option in a LISTVIEW_KIND gadget? | Sim085 | Coders. General | 6 | 16 July 2021 15:28 |
Exec style Devices | bloodline | Coders. System | 23 | 30 November 2020 20:17 |
#LISTVIEW_KIND gadget and keyboard + mouse | peceha | Coders. Blitz Basic | 2 | 15 August 2018 11:26 |
CDTV exec.library | Arnie | support.WinUAE | 19 | 18 February 2016 13:11 |
|
|