View Single Post
velox's Avatar
Posts: 394 | Thanked: 1,341 times | Joined on Dec 2009
#1
(tldr: partly somewhat technical stuff, partly me blabbering on about submenus and ninjablocks)

Since my previous Phone died a few weeks ago (back to N900 for me) and the next one is apparently somewhere in a Warehouse in Finland*, I thought I'd put my insomnia to good use and take the Sailfish SDK for a spin. I do quite a bit of Javascript stuff, so I try to code most of it to included JS files.

After half a night of poking here and there, I've got some rudimentary excuse for a NinjaBlocks app running (it controls 433Mhz actuators and the Block's rgb/rgb8 LEDs), but I could not figure out how to append Items to a PullDownMenu dynamically from Javascript.

When I "onPressAndHold" an Actuator's SilicaListView Item (which, in real life, might correspond to a wall socket command, like 'switch on living room light 1'), I add or remove a favourite (right now via LocalStorage SQL, which on first glance does not seem to be that persistent, at least for SDK deployments – alternatives are always welcome, if you'd like to share).

I really would like those favourite Items to be available in the "Pulley" PullDownMenu, but I have not figured out how to feed a Model (which is pretty easy to manipulate from JS, perfect for me) there – funny, because for SilicaListView it just did what I wanted instantly without me needing a clue about… anything, to be honest.
Have I missed something really obvious? It surely seems like it.

Also, what should be the expected outcome of a long press on a List Item in your opinion? Should there be a sub section popping out containing more options? Should I push a whole new Page to the Stack?
I feel that functionally a ContextMenu could suffice, but it's rather limited in displaying information like that appropriately, because it would have to tell the user the name, current state (enabled/disabled) and that you can actually toggle it. (Am I wrong? Please correct me!)

A normal click on those Items triggers the action directly, and I wouldn't want to complicate this primary function. That's why I immediately went for long click. If this is against best practices – well, I'm about a day into this whole topic and ready for suggestions.

Thanks




*) Fingers crossed.