buttons vs fields vs images best practice?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
buttons vs fields vs images best practice?
Hi, I just cloned a field 160 times to use in a project. The fields are kept invisible and when called on via a nested repeat loop are placed edge to edge top to bottom in a grid. The grid size varies but should never get larger than 40 over and 40 across. There size is adjusted and then they are made visible. I also created 160 transparent buttons to be placed and centers over the fields.as labels. They are also kept invisible until needed and then placed in the repeat loop and made visible.
My question is this. When I created the buttons it took probably 5 times longer to clone them. (about 4 or 5 minutes) This is a1 time set up feature only in development BUT I could probably use graphics or fields as the labels rather than buttons.
What is the least CPU intensive and best practice?
Dave
My question is this. When I created the buttons it took probably 5 times longer to clone them. (about 4 or 5 minutes) This is a1 time set up feature only in development BUT I could probably use graphics or fields as the labels rather than buttons.
What is the least CPU intensive and best practice?
Dave
Re: buttons vs fields vs images best practice?
I wonder what kind of gadget you have made.
I was not sure about the details in your post, so I took the liberty making one field, and doing this:
This gave me 1601 fields in a very tight grid. Took about one second. Again,though still intrigued by what you are doing, could the "lock screen" be the key to your problem?
Craig Newman
Craig Newman
I was not sure about the details in your post, so I took the liberty making one field, and doing this:
Code: Select all
on mouseUp
put the loc of fld 1 into tLoc
lock screen
repeat with u = 1 to 40
repeat with y = 1 to 40
clone fld 1
set the loc of the last field to item 1 of tLoc + u & "," & item 2 of tLoc + y
end repeat
end repeat
end mouseUp
Craig Newman
Craig Newman
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: buttons vs fields vs images best practice?
Adding "lock messages" should give you an additional speed boost.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: buttons vs fields vs images best practice?
Hi,
Map stuff. I am building apha numeric grids. Based on 7 dynamic inputs. entered below as an example
The size of overall rect of the grid
Columns across = 20
Rows Down = 8
Alpha start top left = A
Number Start top left = 29
Alpha runs = across (which means numbers run down)
Then through division and repeat loops build the grid by resizing, relocating, hiding, and showing fields. (like tiles) It is only done to set up the grid and then a snapshot is taken of the grid so performance is not an on-going issue. The fields are built and named sequentialy ahead of time and are invisible and are called by the repeat loop which has to analyze the desired grid output size and the 7 inputs before it can do its thing.
Dave
Map stuff. I am building apha numeric grids. Based on 7 dynamic inputs. entered below as an example
The size of overall rect of the grid
Columns across = 20
Rows Down = 8
Alpha start top left = A
Number Start top left = 29
Alpha runs = across (which means numbers run down)
Then through division and repeat loops build the grid by resizing, relocating, hiding, and showing fields. (like tiles) It is only done to set up the grid and then a snapshot is taken of the grid so performance is not an on-going issue. The fields are built and named sequentialy ahead of time and are invisible and are called by the repeat loop which has to analyze the desired grid output size and the 7 inputs before it can do its thing.
Dave
Re: buttons vs fields vs images best practice?
What's your repeat loop look like?
You'll get *much* better speed from a "repeat for each" construct than a "repeat with" construct, as in orders of magnitude faster.
Q: Why not just create a card with a 40x40 grid of fields/buttons ahead of time and then just display the ones you need?
You'll get *much* better speed from a "repeat for each" construct than a "repeat with" construct, as in orders of magnitude faster.
Q: Why not just create a card with a 40x40 grid of fields/buttons ahead of time and then just display the ones you need?
Re: buttons vs fields vs images best practice?
Thanks mark,
Thats exactly what I did although 40 x 40 became a bit overpopulating. What I settled on for ipad was 20 across 30 down. Thanks for the advise on the repeat loop. I have always used the snot out of the repeat with x = 1 to whatever. I think what was taking so long was I was naming each file to say "column && x && Row && y" as I was doing the cloning. I was also messing with the script and by that time most likely I had mucho controls on the card. At this point I think I'm all good to go. If will post the code snipet later when I get on my Mac.
Thanks
Dave
Thats exactly what I did although 40 x 40 became a bit overpopulating. What I settled on for ipad was 20 across 30 down. Thanks for the advise on the repeat loop. I have always used the snot out of the repeat with x = 1 to whatever. I think what was taking so long was I was naming each file to say "column && x && Row && y" as I was doing the cloning. I was also messing with the script and by that time most likely I had mucho controls on the card. At this point I think I'm all good to go. If will post the code snipet later when I get on my Mac.
Thanks
Dave