Hot!Aria Drop Down Box

Author
bblessing
Super Member
  • Total Posts : 467
  • Reward points : 0
  • Joined: 2008/12/04 06:44:21
  • Location: Cincinnati, OH
  • Status: offline
2017/09/29 07:46:17 (permalink)
0

Aria Drop Down Box

How would this be implemented? I'm assuming that I'll need to add a List, a button next to it with a down arrow for its text, and a scroll bar that appears and disappears when the List is dropped down and pulled back up. If there is an easier way, I'd be very appreciative to learn it.
 
Additionally, regarding strings, can we add copy/paste to the string assets dialog? With a bunch of different languages and different fonts, it's getting unwieldy. I think this would be helpful.
 
Edit: Nevermind. It's weird. I didn't see the scroll bar next to the list before, but now I do.
post edited by bblessing - 2017/09/29 07:56:22
#1

8 Replies Related Threads

    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/09/29 08:48:42 (permalink)
    0
    Ok, now I'm very confused. The scrollbar that comes with the List Widget is effectively useless as it's so small. Worse, it doesn't seem to work as I would think. Pressing and holding the bottom arrow (which I have to do with the tip of a pencil) only seems to scroll down a bit, and I can't access the other items in the list.
    #2
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/02 07:14:54 (permalink)
    0
    Can someone from Microchip please comment? I can't seem to get the list widget to work the way that I think it should work, and there is little to know documentation on its use.
     
    If you create an laListWidget using GC, you'll see a blank box. Make it large enough and you'll be able to see the strings that you've listed. I didn't include any icons, as I didn't think it was necessary.
     
    In all cases a blank item is included. I got rid of this by going to libaria_init and removing the first laListWidget_AppendItem and then renumbering the later additions. Whether I do this or not, if I select something at run time it will crash.
     
    Sometimes there is a button with a down arrow next to the list widget, other times there is not. Pressing this button does nothing. There is no way to have the list "drop down" as you would expect.
     
    Is the laListWidget irreparably broken? I did a search in the apps/gfx folder but didn't find any uses, though it didn't turn up in object, elf, and map files.
    #3
    Freezessc
    Starting Member
    • Total Posts : 43
    • Reward points : 0
    • Joined: 2016/11/08 14:36:45
    • Location: 0
    • Status: offline
    Re: Aria Drop Down Box 2017/10/02 09:04:17 (permalink)
    0
    how is it crashing? It should just toggle an event and whatever you've coded should take over.  I was able to get a list to create a menu without too much trouble, in the event handler I just called my own function that looked at what was selected and loaded a menu screen with relevant parameters.  
    #4
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/02 13:42:23 (permalink)
    0
    Thanks for the reply! I would point out that I'm using 90° mode, which may be part of the problem. In any case, I simply drag a listWidget onto the designer. I set local redraw, size, etc. I then go to the list configuration dialog and add items to the list (six in my case). I'll generate and run.
     
    I have the height set to 20, the thinking being that if you click it the entire list is displayed. Clicking the arrow button (comes with the list widget) to the right of the list widget does nothing. Clicking the widget works, but the list never drops down. Fine. I then go back to the graphics composer and make the list height larger, say 200 pixels. Now the entire list is displayed, but it never drops back and the arrow button is no longer displayed. I can select different items, but somewhere along the line if I select an item it stays selected and the whole screen is frozen. Very strange.
     
    I don't have any logic in the event because I don't really need it: if this works the way I think it should, then I can simply look at the selected index/item from a separate event. Regardless, for now, the widget itself doesn't seem to operate correctly.
     
    Has anyone gotten this to work in 90° mode
    #5
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/03 11:42:08 (permalink)
    3 (1)
    I think that I'm beginning to understand the issue. Here is how I "think" this should work. At start up you should have a box that displays the selected item, or nothing at all in the case of an empty list, and the down arrow button part of a scroll bar. If you press either the box or the button, the list of items will drop down. If it's a huge list, only the first so many items are displayed and the scroll bar is enlarged so that you can scroll through the list. As soon as you select an item, everything collapses back to the initial state with the item you selected highlighted and displayed.
     
    Anyway, I think the crashing issue is a 90° mode issue, as I didn't see it with a test application that I set up in 0° mode. Even then, to do what I've outlined in the previous project requires manipulating the internal scroll bar widget within the list widget. In the meantime, I'm debating splitting the two things up somehow.
    #6
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/04 08:51:34 (permalink)
    0
    So I started debugging this and I do get an exception at line 626 of libaria_string.c. The exception is a Load/fetch address error. I got rid of the while (1) in _general_exception_handler so that I could step out and see the call stack. Generally speaking a touch event led to this function being called:
     
    _laListWidget_GetRowRect in libaria_widget_list_skin_classic.c
    laString_GetRect in libaria_string.c
     
    The exception only occurs if I select something on the widget and then slide my finger OFF of the widget. Yes, you shouldn't do that, but users inevitably will.
     
    Edit: I've been fumbling around trying to find a solution, or at least the cause of the problem, and I have noticed that the crashing stops IF I return from _laListWidget_GetRowRect with an idx value of -1. Still, there is absolutely no scrollbar visible in 90° mode.
     
    Edit2: Or...overriding the list widget's touch moved event, provided the override function contains evt->event.accepted = LA_FALSE. It's still VERY annoying that I can't get the scrollbar part of the list widget to display.
    post edited by bblessing - 2017/10/04 10:55:43
    #7
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/06 10:09:21 (permalink)
    0
    I think I've narrowed this down. In libaria_widget_list.c there is a touchMoved function. Here is the code for that:
     
     
    static void touchMoved(laListWidget* lst, laInput_TouchMovedEvent* evt)
    {
        GFX_Point pnt;
        uint32_t idx;
        
        pnt.x = evt->x;
        pnt.y = evt->y;
        
        idx = getRowAtPoint(lst, &pnt);
        
        if(idx >= 0 && idx < lst->items.size)
        {
            if(lst->itemDown != idx)
            {
                invalidateRow(lst, lst->itemDown);
                
                lst->itemDown = idx;
            
                invalidateRow(lst, lst->itemDown);
            }
        }
        else if(lst->itemDown != -1)
        {
            invalidateRow(lst, lst->itemDown);
            
            lst->itemDown = -1;
        }
        
        evt->event.accepted = LA_TRUE;
    }

     
    In the block with two InvalidateRow calls there is the possibility that InvalidateRow is called with lst->itemDown set to -1. If you change if (lst->itemDown != idx) to if((lst->itemDown != idx) && (lst->itemDown != -1)) then it fixes the crashing. I think this is because InvalidateRow will have its row argument set to -1, which obviously bad as it ends up being used as an index into lst->items.values.
    #8
    bblessing
    Super Member
    • Total Posts : 467
    • Reward points : 0
    • Joined: 2008/12/04 06:44:21
    • Location: Cincinnati, OH
    • Status: offline
    Re: Aria Drop Down Box 2017/10/06 13:47:41 (permalink)
    5 (1)
    Actually, it should be this:
     
    static void touchMoved(laListWidget* lst, laInput_TouchMovedEvent* evt)
    {
        GFX_Point pnt;
        uint32_t idx;
        
        pnt.x = evt->x;
        pnt.y = evt->y;
        
        idx = getRowAtPoint(lst, &pnt);
        
        if(idx >= 0 && idx < lst->items.size)
        {
            if(lst->itemDown != idx)
            {
                if (lst->itemDown != -1)
                {
                    invalidateRow(lst, lst->itemDown);
                }
                
                lst->itemDown = idx;
            
                invalidateRow(lst, lst->itemDown);
            }
        }
        else if(lst->itemDown != -1)
        {
            invalidateRow(lst, lst->itemDown);
            
            lst->itemDown = -1;
        }
        
        evt->event.accepted = LA_TRUE;
    }

     
    This seems to work even better.
    #9
    Jump to:
    © 2017 APG vNext Commercial Version 4.5