Page 1 of 1
Float Left
Posted: Thu Aug 01, 2013 1:12 am
by anrob
Im new to Live code and not sure how to do this.
i am generating a list of folders from my computer.
The process goes like this.
I choose a folder
then click a button
based on the list of folders i can create buttons
Right now the buttons show up in a list strait up and down.
What i am trying to is show the list of folder 4 across. instead of just in a list.
Iam including my code.
the reason i title this float left is becasuse in CSS thats what i would do. no idea how to do this in live code.
function filterDots pList
local tList
put pList into tList
filter tList without "."
filter tList without ".."
return tList
end filterDots
# Returns a filtered list of files in the current directory
function filteredFiles
return filterDots(the files)
end filteredFiles
# Returns a filtered list of folders in the current directory
function filteredFolders
return filterDots(the folders)
end filteredFolders
function makebuttons
local textf
put 70 into tMarge
put the loc of btn btnEndUse into tStartLoc
repeat for each line textf in field "textf"
set the label of the templateButton to textf
set the name of the templateButton to textf
set the style of the templateButton to opaque
set the width of the templateButton to 136
set the height of the templateButton to 70
set icon of the templateButton to 348
set textColor of the templateButton to "white"
set textStyle of the templateButton to "bold"
#set the backgroundColor of templateButton to "blue"
### set the width of templateButton to 50
# set the height of templateButton to 20
put item 1 of tStartLoc into tX
put item 2 of tStartLoc into tY
set the loc of the templateButton to tX,tY+tMarge
put the loc of the templateButton into tStartLoc
create button
end repeat
end makebuttons
## List Files button script
on mouseUp
local tFolder, tFileList, makebuttons
put field "Folder" into tFolder
set the defaultFolder to tFolder
put filteredFolders() into field "textf"
put makebuttons() into field "newlist"
end mouseUp
any help would be awesome i have only been working with livecode for a week now but love it.
Re: Float Left
Posted: Thu Aug 01, 2013 1:52 am
by Simon
Hi anrob,
Welcome to the forum
I'm not seeing how they are even ending up in a column, but never mind.
To simplify some things check out "rectangle" in the dictionary.
Oh and what the heck, I'll attach a stack.
This uses graphics but buttons would work the same.
Maybe I didn't even understand the question.
Simon
Re: Float Left
Posted: Thu Aug 01, 2013 2:37 am
by anrob
Simon wrote:Hi anrob,
Maybe I didn't even understand the question.
Simon
Thank you for getting back to me. i think you have it right. but since i am new at this it didnt really help - YET i am attaching the stack that i have in order for it to make clearer.
thanks again.
i will look at the stack that you sent and see if i can make it make sense
When i open the stack i then click choose folder an then click List files.
you will see how it works then . what i really need to to list the folders in a scrollerable field. but this is just a start.
Re: Float Left
Posted: Thu Aug 01, 2013 9:40 am
by LCNeil
Dear anrob,
Thank you for your request.
If you want the field that contains the list of folders to be scrollable, all you need to do is enable the vertical scroll bars from within the fields property inspector.
Once you do this you will see a scroll bar appear like in the attached screenshot.
You can also make each item selectable in the list by enabling the "list Behaviour" property of the field.
I hope this gives you some leads.
Kind Regards,
Neil Roger
-----
RunRev Support Team ~
http://www.runrev.com
------
Re: Float Left
Posted: Thu Aug 01, 2013 6:55 pm
by Simon
Hi anrob,
OK, I think I have what you wanted.
In the attached stack there are still plenty of problems (just details for you to work out) but the part I think you want has been implemented.
My understanding was that you want the folders to show up 4 across, which is what I did but you will have to adjust the script for a changing width of the "Scroll" group. You should expect it's width to change.
The most important command that you were looking for is "start editing..." this allows for the vertical scroll bar to actually do something when needed.
Any more questions just ask.
Simon
Re: Float Left
Posted: Sat Aug 03, 2013 7:15 pm
by anrob
Simon,
Thank you - That is excatly what i wanted.
you said ther are still problems. im sure i can figure that part out.
but the foolders post 4 across is what i was looking for.
Awesome.
Thank you much
Re: Float Left
Posted: Sat Aug 03, 2013 7:21 pm
by Klaus
Dear RunRev Support Team,
runrevneil wrote:Dear anrob,
Thank you for your request.
If you want the field that contains the list of folders to be scrollable, all you need to do is enable the vertical scroll bars from within the fields property inspector.
Once you do this you will see a scroll bar appear like in the attached screenshot.
You can also make each item selectable in the list by enabling the "list Behaviour" property of the field.
I hope this gives you some leads.
Kind Regards,
Neil Roger
that was not the question, good luck for the future!
Best
Klaus
Re: Float Left
Posted: Sat Aug 03, 2013 7:30 pm
by Simon
Hi anrob,
Thanks for taking the time to respond to my post, too often peeps just run away without thanking us volunteers.
Glad it's what you wanted. You should be prepared to have any number of folders across depending on the width of the users window. I'm pretty sure you can figure out how to do that.
Just to freak you out make sure you drop a breakpoint within the "start editing" to see all your UI disappear.
If you have any more questions just ask.
Simon
Re: Float Left
Posted: Sat Aug 03, 2013 7:45 pm
by dave_probertGA6e24
Klaus you beat me to it
RunRev people should not attempt to answer complicated questions unless they read what the question
actually is. And only then if they can provide pertinent answers.
But don't give up trying
Cheers,
Dave
Re: Float Left
Posted: Sun Aug 04, 2013 2:49 pm
by LCNeil
Wow. After reading back my response...I can see it is completely off the mark.
I must have been in autopilot when trying to answer.
Thank you Dave and Klaus for pointing this out
Kind Regards,
Neil Roger,
--
RunRev Support Team ~
http://www.runrev.com
--
Re: Float Left
Posted: Sun Aug 04, 2013 6:31 pm
by Klaus
Simon wrote:...Just to freak you out make sure you drop a breakpoint within the "start editing" to see all your UI disappear...
You're SO mean, Dude!

Re: Float Left
Posted: Sun Aug 04, 2013 7:36 pm
by anrob
Simon.
I set the break point and saw it all disapper. Am i doing sothing wrong that would cause that?
Like i said i am only a week into LiveCode. I signed up for the Summer School and cant wait for it to begin. im also going thru LC university. But im learning Fast.
Also, Klause. Thank you for jumping in an saying something. I didnt really know how to respond and felt kinda dumb, so i just said nothing.
RevRun Support. No big Deal. We are all humnan and life can be foggy sometimes. All Good. Thanks
Hope i got everybody. Thank you and this is fun being part of this.
Larry
Re: Float Left
Posted: Sun Aug 04, 2013 7:53 pm
by Klaus
Hi anrob,
no, you did nothing wrong!
That's the way Livecode works, without a breakpoint you wouldn't even notice this
While waiting for the Academy to start, you might want to take a look at these stacks,
great learning resources to get started with the basics of Livecode:
http://www.hyperactivesw.com/revscriptc ... ences.html
Best
Klaus
Re: Float Left
Posted: Sun Aug 04, 2013 7:59 pm
by anrob
Klaus,
Thank you, what a great resource. Thanks for making my sunday more productive.
Best,
Larry
Re: Float Left
Posted: Sun Aug 04, 2013 8:02 pm
by Simon
Hi Larry,
I set the break point and saw it all disapper. Am i doing sothing wrong that would cause that?
Nope this is how it works, it's the same if you select a group then hit "Edit Group".
Also, Klause. Thank you for jumping in an saying something. I didnt really know how to respond and felt kinda dumb, so i just said nothing.
Actually you should have said something. As I mentioned before, people will just disappear once they get the answer they wanted. Had I not thought I understood the question better I would have assumed because you didn't reply that the answer given solved your problem.
Keep asking questions, and remember the old adage:
"The only dumb question is the one I can't answer"

or something like that.
Simon