Reaction ListBrowsers - Some basic questions

42 posts / 0 new
Last post
AmigaOneFan
AmigaOneFan's picture
Offline
Last seen: 10 years 11 months ago
Joined: 2011-11-14 16:18
@salass00 Okay, I'll see

@salass00

Okay, I'll see about implementing this correctly using SetPageGadgetAttrs().

My latest updated code is now available here: http://www.os4coding.net/source/162

Thanks for all your help!

trixie
trixie's picture
Offline
Last seen: 6 months 3 weeks ago
Joined: 2011-02-03 13:58
Re: Reaction ListBrowsers - Some basic questions

@salass00

I find it strange that you do not know this...

You never stop learning :-) I didn't do programming at school; surprisingly, I studied literature.

AmigaOne X5000-020 / 2GB RAM / Sapphire Pulse Radeon RX 560 / AmigaOS 4.1 Final Edition Update 2

alfkil
alfkil's picture
Offline
Last seen: 3 months 6 days ago
Joined: 2011-05-10 22:02
And now for something

And now for something completely different: How does one make the LBNCA_FGPen tag to work??
I have retrieved 3 different pens with IGraphics->ObtainBestPain, the values returned seem to be sane, so why is my text still all black?

Here's ma code for reference:

  1. void console_printf(enum output_types type, char *fmt, ...)
  2. {
  3. char buffer[1024];
  4. va_list args;
  5. va_start(args, fmt);
  6. vsnprintf(buffer, sizeof(buffer), fmt, args);
  7. va_end(args);
  8.  
  9. struct Node *node;
  10. char *str = freemem_strdup (console_freemem_hook, buffer);
  11. if (node = IListBrowser->AllocListBrowserNode(2,
  12. LBNA_Column, 1,
  13. LBNCA_FGPen, console_pens[type],
  14. LBNCA_Text, str,
  15. TAG_DONE))
  16. {
  17. IExec->AddTail(&console_list, node);
  18. }
  19. IIntuition->RefreshGadgets ((struct Gadget *)ConsoleListBrowserObj, mainwin, NULL);
  20. }
gazelle
gazelle's picture
Offline
Last seen: 1 year 9 months ago
Joined: 2011-04-13 12:52
You have to specify the

You have to specify the LBFLG_CUSTOMPENS flag in LBNA_Flags for the node.

alfkil
alfkil's picture
Offline
Last seen: 3 months 6 days ago
Joined: 2011-05-10 22:02
Thanks Gazelle :). Now I have

Thanks Gazelle :). Now I have this marvelous red warning in my niffy little console window, yay!
Question now is: How could I ever have known this if you hadn't told me...??

gazelle
gazelle's picture
Offline
Last seen: 1 year 9 months ago
Joined: 2011-04-13 12:52
From the AutoDocs of

From the AutoDocs of listbrowser_gc.doc:

LBNCA_FGPen (int16)
LBNCA_BGPen (int16)
    The pens to be used for rendering the text or integer in this
    column. Requires that the LBFLG_CUSTOMPENS flag in LBNA_Flags
    be specified otherwise the default system pens will be used.
alfkil
alfkil's picture
Offline
Last seen: 3 months 6 days ago
Joined: 2011-05-10 22:02
Ah I found it, ok. I was

Ah I found it, ok. I was looking at AllocListBrowserNode and didn't see anything there. Thanks for the pointer!

alfkil
alfkil's picture
Offline
Last seen: 3 months 6 days ago
Joined: 2011-05-10 22:02
Now another strange problem:

Now another strange problem: My lists content is larger than can be shown inside the listbrowser at one time, and I would expect the scrollbars to become usable. But they don't. I think they used to do that earlier (that is when I started developing db101), so maybe something has changed? This is a common problem for all the tonnes of listbrowsers I am using in the app. Am I being totally stupid here??

EDIT: Problem solved, with help from previous posts in this thread. Apparently one needs to remove the node list from the listbrowser with SetAttrs(lb, LISTBROWSER_Labels, ~0, TAG_END); and then add it back after modification with SetGadgetAttrs. This is cryptic, though. Why doesn't it work to use RemoveGadget and then AddGadget afterwards? Also, I am pretty sure, that earlier it worked just calling RefreshGadgets after adding nodes to the list. Why has this changed?

gazelle
gazelle's picture
Offline
Last seen: 1 year 9 months ago
Joined: 2011-04-13 12:52
You are not allowed to change

You are not allowed to change the list if it is attached to the list browser. For changing the nodelist you should either use the methods of the list browser (LBM_ADDNODE, ...) or detach the list, make your changes and attach it again.

alfkil
alfkil's picture
Offline
Last seen: 3 months 6 days ago
Joined: 2011-05-10 22:02
Well, in any case it works

Well, in any case it works now, so thank you for the help! :)

AmigaOneFan
AmigaOneFan's picture
Offline
Last seen: 10 years 11 months ago
Joined: 2011-11-14 16:18
Some more questions about

Some more questions about Reaction listbrowsers.

I apologize if these are dumb questions, but I looked in the autodocs and can't see the answer.

1) Is there a way to change the behavior of a listbrowser element (field) so that when a user clicks somewhere else WITHOUT hitting enter their data is not lost? Currently, if you do not press ENTER explicitly after modifying any listbrowser field, you lose the data you just typed in. That's really frustrating....there must be a better way?

2) Is there a way to make it so that you can move from field to field in a listbrowser using the TAB key? Suppose I have 4 fields per line, such as Name, Number, Date, Phone Number, and I am currently editing the Name field. I would like to press the TAB key to save the data I am currently editing and also move me to the right one column (into the Number field in this example.) Is such a thing possible? If I am in the Phone Number field, I would like it to move me to the Name field (wrap around).

3) Is there a way to make it so that you can single click on a listbrowser field to begin editing it instead of having to select it (single click) and THEN double click on it to edit?

I have somewhat finished my Amisafe program, incorporated the encoding and decoding algorithms for the data, and am trying to improve the interface handling. It is VERY awkward having to always hit ENTER and use effectively triple mouse clicks to edit fields in my listbrowsers. If there are solutions to any or all of the above questions, that would be wonderful!

Thanks!

Pages

Log in or register to post comments