Float Left

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
anrob
Posts: 10
Joined: Wed Jul 31, 2013 4:49 pm

Float Left

Post by anrob » Thu Aug 01, 2013 1:12 am

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.

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Float Left

Post by Simon » Thu Aug 01, 2013 1:52 am

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
Attachments
grid_maker.zip
LC 6.1
(992 Bytes) Downloaded 346 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

anrob
Posts: 10
Joined: Wed Jul 31, 2013 4:49 pm

Re: Float Left

Post by anrob » Thu Aug 01, 2013 2:37 am

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.
Attachments
Folder.livecode.zip
Folder sorter
(4.27 KiB) Downloaded 305 times

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Float Left

Post by LCNeil » Thu Aug 01, 2013 9:40 am

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
------
Attachments
Screen Shot 2013-08-01 at 09.38.20.png
screenshot

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Float Left

Post by Simon » Thu Aug 01, 2013 6:55 pm

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
Attachments
Folder_simon.zip
LC 6.1
(3.01 KiB) Downloaded 292 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

anrob
Posts: 10
Joined: Wed Jul 31, 2013 4:49 pm

Re: Float Left

Post by anrob » Sat Aug 03, 2013 7:15 pm

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

Klaus
Posts: 14216
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Float Left

Post by Klaus » Sat Aug 03, 2013 7:21 pm

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! :-D

Best

Klaus

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Float Left

Post by Simon » Sat Aug 03, 2013 7:30 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

dave_probertGA6e24
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 328
Joined: Mon Dec 05, 2011 5:34 pm
Contact:

Re: Float Left

Post by dave_probertGA6e24 » Sat Aug 03, 2013 7:45 pm

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
Coding in the Sun - So much Fun.
Visit http://electronic-apps.info for released App information.

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Float Left

Post by LCNeil » Sun Aug 04, 2013 2:49 pm

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
--

Klaus
Posts: 14216
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Float Left

Post by Klaus » Sun Aug 04, 2013 6:31 pm

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! :-D

anrob
Posts: 10
Joined: Wed Jul 31, 2013 4:49 pm

Re: Float Left

Post by anrob » Sun Aug 04, 2013 7:36 pm

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

Klaus
Posts: 14216
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Float Left

Post by Klaus » Sun Aug 04, 2013 7:53 pm

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

anrob
Posts: 10
Joined: Wed Jul 31, 2013 4:49 pm

Re: Float Left

Post by anrob » Sun Aug 04, 2013 7:59 pm

Klaus,

Thank you, what a great resource. Thanks for making my sunday more productive.

Best,

Larry

Simon
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3901
Joined: Sat Mar 24, 2007 2:54 am

Re: Float Left

Post by Simon » Sun Aug 04, 2013 8:02 pm

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
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!

Post Reply