New Candy Lib: Widget Candy for Corona

Is it possible to use Text Candy text in Widget Candy? [import]uid: 8697 topic_id: 25953 reply_id: 107643[/import]

@x-pressive.com

What I mean is that you have a list box example that has multiple sliders that can be on or off, this is great for like settings screens.

But when choosing multiple items in a list showing a list of items with check boxes instead of sliders would be really great and very useful.

Thanks

Larry [import]uid: 11860 topic_id: 25953 reply_id: 107723[/import]

Also can you provide an example to create the Multi-Level Select List using code

Like the List->Changing List

i understand how to create the first level list like this
local ListData = {}
table.insert(ListData, 1, { iconL = 1, caption = “Hello 1”})
table.insert(ListData, 2, { iconL = 2, caption = “Hello 2”})

but how do i created a second level of list for each of the above nodes thru code instead of hard coded like in your provided example.

thanks

Larry [import]uid: 11860 topic_id: 25953 reply_id: 107724[/import]

I noticed that if you have a button the following happens:

When you press the button and move off the button the button comes up (as it should) but if you then release the button (while not on it) it still acts as if you’ve pressed it. Basically once you press the button the action for the button happens whether you are on the button or not.

I fixed it though by the following, I replaced the following line in V._OnWidgetTouch release section

if Props.onRelease ~= nil then Props.onRelease( EventData ) end

with
if Props.onRelease ~= nil then
if EventData.inside == true then Props.onRelease( EventData ) end
end

not sure if that’s a permanent fix but it seems to work

of course it could be written by

if Props.onRelease ~= nil and EventData.inside == true then Props.onRelease( EventData ) end
[import]uid: 8697 topic_id: 25953 reply_id: 107727[/import]

@doubleslashdesign: the “list sliders” are nothing more than icons that are changed for each list item when tapped to indicate the current state of each item. You can easily change this to checkbox images just by changing the icon number in the example code and providing an icon sheet with two checkbox icons (checked and unchecked).

@cublah: this button behavior is intentional -if you tap a button, it appears pressed as long as your finger is over it to let the user know if he is currently inside or outside the button. When it is released (wether outside or not) the “onRelease” listener function is called anyway because it’s up to you then to check if the user released the finger outside the button or not and to decide what to do:

[lua]onRelease = function(EventData)
– RELEASED OUTSIDE? DO NOTHING
if EventData.inside == false then return
– RELEASED INSIDE:

end,[/lua]

[import]uid: 10504 topic_id: 25953 reply_id: 107749[/import]

Ok so I got the above sample working (code above updated),

When you click on item 1 or 2 it switches to the 2nd and 3rd lists.

( YEAH )

But I don’t understand using code (dynamically ) how I am suppose to set the
parentList = ListData,

so that I can have a button at the top of my list to return to the previous list (ListData)

Thanks

Larry
DoubleSlashDesign.com [import]uid: 11860 topic_id: 25953 reply_id: 107988[/import]

i was just about to post about the parentList when you updated your post, i’m not sure where you got that command from because its not on the api on widget candy site. For the back button on the list i just added a new square button and set the function to change the list back to the previous list by getting the current list or you can save the previous list in a variable and call that. I put the square button on the title bar of the list. [import]uid: 126161 topic_id: 25953 reply_id: 107989[/import]

parentList = V.ListMain,

is actually used in the widget_candy sample file

sample_list_change_lists.lua

But everything in there is hard coded, which is good but my code needs to be dynamic so I can update the lists through a database or xml file.

Larry
[import]uid: 11860 topic_id: 25953 reply_id: 107992[/import]

yea my list is updated via a mysql database and another list is updated via an xml document. So i just added that back button and it works fine for me, no problems at all. [import]uid: 126161 topic_id: 25953 reply_id: 107993[/import]

looking in the Widget_candy lua file I see that this is suppose to be automated for you ( yea ) so you don’t need to add your own back button - although you can.

I figured it out I’ll update my code above.

Larry [import]uid: 11860 topic_id: 25953 reply_id: 107995[/import]

Ok here you go list dynamically and having the back button appear at the top for the drill down lists to send you back to the first list.

local ListData = {}  
table.insert(ListData, 1, { iconL = 1, caption = "Hello 1"})  
table.insert(ListData, 2, { iconL = 2, caption = "Hello 2"})  
  
local ListData2 = {}  
table.insert(ListData2, 1, { iconL = 1, caption = "Hello2 1"})  
table.insert(ListData2, 2, { iconL = 2, caption = "Hello2 2"})  
table.insert(ListData2, 3, { iconL = 3, caption = "Hello2 3"})  
table.insert(ListData2, 4, { iconL = 4, caption = "Hello2 4"})  
table.insert(ListData2, 5, { iconL = 5, caption = "Hello2 5"})  
ListData2.parentList = ListData --Added this property for candy\_widget code to create back button for me  
  
local ListData3 = {}  
table.insert(ListData3, 1, { iconL = 1, caption = "Hello3 1"})  
table.insert(ListData3, 2, { iconL = 2, caption = "Hello3 2"})  
table.insert(ListData3, 3, { iconL = 3, caption = "Hello3 3"})  
table.insert(ListData3, 4, { iconL = 4, caption = "Hello3 4"})  
table.insert(ListData3, 5, { iconL = 5, caption = "Hello3 5"})  
ListData3.parentList = ListData --Added this property for candy\_widget code to create back button for me  
  
 \_G.GUI.NewList(  
 {  
 x = "center",   
 y = "center",   
 width = "70%",   
 height = "70%",  
 scale = \_G.GUIScale,  
 parentGroup = nil,   
 theme = "theme\_1",   
 name = "LST\_SAMPLE",   
 caption = "Replacing Lists",   
 list = ListData,   
 allowDelete = true,   
 readyCaption = "Quit Editing",   
 border = {"shadow", 8,8, 64},  
 onSelect = function(EventData)  
 local Widget = EventData.Widget  
 local List = EventData.List  
 local Item = EventData.Item  
 local num = EventData.selectedIndex  
 -- SWITCH TO LIST A OR B  
 if List == ListData then  
 if num == 1 then Widget:setList(ListData2, "left")  
 elseif num == 2 then Widget:setList(ListData3, "left") end  
 end  
 end,  
 } )  

Thanks
Larry [import]uid: 11860 topic_id: 25953 reply_id: 107902[/import]

ill have to look into that, thanks for the info, I’m a creature of habit and i like to look at apis instead of examples, sometimes when stuff is not documented it works against me. [import]uid: 126161 topic_id: 25953 reply_id: 107996[/import]

Anytime :slight_smile:

I am the same way - but since i’m am so lazy to do for myself I’ll spend more time to figure it out :slight_smile: Or beat my head against the wall trying…

Larry [import]uid: 11860 topic_id: 25953 reply_id: 107999[/import]

@x-pressive.com

I installed the most recent version and still have problems with multiline text:

When text spans more than 1 line, all lines except last are displayed as colored rectangle (the color of the text font). How can I fix that? (it is not related to widget placement, font size, font), might have to do with device scaling method.

Thanks for help.
(had posted that accidentally in wrong plugin thread some days ago, not sure issue has been discussed, everything within 1 thread makes issues difficult to follow) [import]uid: 109677 topic_id: 25953 reply_id: 108028[/import]

@x-pressive.com

I’m having a wild issue with this switcher.

I have a window called WIN_SAMPLE that i assign 3 switchers to.
When the screen loads the switches all line up perfect in the correct locations of the window.

The problem is the as I flip the switch on each item the switches relocate to the TOP of the window for some reason. they just jump to the top. Any clue why?

[code]
– CREATE A SWITCH
_G.GUI.NewSwitch(
{
x = “10”,
y = “50”,
width = 200,
scale = _G.GUIScale,
name = “RANDOMIZE”,
parentGroup = “WIN_SAMPLE”,
theme = “theme_1”,
toggleState = true,
textAlign = “left”,
caption = “Randomize”,
onChange = function(EventData)
local value = tostring(EventData.toggleState)
EventData.Widget:set (“caption”, "Randomize "…value)
end
} )

– CREATE A SWITCH
_G.GUI.NewSwitch(
{
x = “10”,
y = “100”,
width = 200,
scale = _G.GUIScale,
name = “LOOP”,
parentGroup = “WIN_SAMPLE”,
theme = “theme_1”,
toggleState = true,
textAlign = “left”,
caption = “Loop”,
onChange = function(EventData)
local value = tostring(EventData.toggleState)
EventData.Widget:set (“caption”, "Loop "…value)
end
} )
[/code] [import]uid: 11860 topic_id: 25953 reply_id: 108778[/import]

@doubleslashdesign: Just remove the quotation marks from the x and y and it should work. [import]uid: 129287 topic_id: 25953 reply_id: 108783[/import]

yep worked like a champ, I almost tried that as well. Next time I wont wait.

Thanks

Lazy Larry :slight_smile: [import]uid: 11860 topic_id: 25953 reply_id: 108830[/import]

@x-pressive.com

Here is an interesting little BUG, create a switch to set as false ( initial state ( then using the SET command set it to true and also set the caption - to mimic reading data from a file you know )

Now when the switch loads the switch is position is displayed as on / true and the caption says “Randomize On”.

Now click to turn it off - the switch turns off but the FIRST TIME you click the switch to off the text does not change. Every additional click acts correctly and the text changes just fine.

And clue why?

[code]
– CREATE A SWITCH
_G.GUI.NewSwitch(
{
x = 10,
y = 50,
width = 200,
scale = _G.GUIScale,
name = “RANDOMIZE”,
parentGroup = “WIN_SAMPLE”,
theme = “theme_1”,
toggleState = false,
textAlign = “left”,
caption = “Randomize off”,
onChange = function(EventData)
local value = tostring(EventData.toggleState)
if(value==“true”) then
EventData.Widget:set (“caption”, “Randomize On”)
else
EventData.Widget:set (“caption”, “Randomize Off”)
end
end
} )

_G.GUI.Set( “RANDOMIZE”, { toggleState = true, caption = “Randomize On” } )
[/code] [import]uid: 11860 topic_id: 25953 reply_id: 108831[/import]

@doubleslashdesign: This looks like a bug to me. It’s the same issue which @khincker reported on the GUI.newButton and @x-pressive.com should probably double-check this for all the different buttons.

A small hint: You don’t have to convert the EventData.toggleState to a string since the true/false values are boolean. Just check for true/false without using the quotation marks:

if EventData.toggleState == true then [import]uid: 129287 topic_id: 25953 reply_id: 108838[/import]

@Dr.Mabuse

Yeah I know that about the == true, I just copied the code from either the website or one of the samples. Thanks for letting me know about the bug.

@x-pressive.com please keep us updated on the fix.

Also GREAT job, as I am using this to move my settings screens and such right along at a nice brisk pace :slight_smile:

Larry
[import]uid: 11860 topic_id: 25953 reply_id: 108851[/import]