I have written a complete media player with LiveCode in under a week. But I'm really struggling to display items in a list nicely across all platforms (Mac, Windows, Android, IOS).
I don't really know if I do this the right way and there is not much information available.
I created a group and in the group script for each element I copy a group of two buttons inside (an "iconButton" and a "textButton"). Reason I don't only use one button is that it is not possible to align the text left to the icon in a button as the text will be aligned right.
I have following questions:
* Is this the right way to create a list with items? Or am I over-complicating something that is much easier to accomplish?
* On the IOS simulator it seems that the gaps between the group elements haven't the same spacing depending on the position of the scrollbar. What could be the problem there? It works on Mac. (see attached .tiff Screenshot)
I constantly bump in to new issues.
Here the code that is in the group
Code: Select all
on openControl
removeButtons
put the top of me + 10 into tTop
put the left of me + 4 into tLeft
put (the width of me - the scrollbarWidth of me - 10) into tWidth
repeat with a = 1 to 30
put "test_" & a into tName
put "Test_" & a into tLabel
copy group "templateBtn2" to me
set the name of group "templateBtn2" to tName
set the right of button "textBtn" of group tName to (the right of button "textBtn" of group tName - the scrollbarWidth of me + 8)
set the label of button "textBtn" of group tName to tLabel
set the lockLoc of button "iconBtn" of group tName to true
set the lockLoc of button "textBtn" of group tName to true
set the lockLoc of group tName to true
set the top of group tName to tTop
set the left of group tName to tLeft
set the btType of group tName to "itemButton"
put the bottom of group tName - 6 into tTop
end repeat
end openControl
on removeButtons
local a
-- Lock the screen so that this is nice and fast
lock screen
-- Loop through all the controls in the stack. NOTE: we have to loop downwards to zero as we may be
-- removing controls while in the loop - not doing this causes Badness.
repeat with a = the number of controls down to 1
-- Check the custom property "cPreviewControl" to see if this control is a thumbnail image and delete it.
if the btType of control a is "itemButton" then delete control a
end repeat
unlock screen
end removeButtons
Thanks,
Chris