LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
it works if you do this routine lets say from a button on the card where the "track" buttons are (tested). Rev assumes that the button i is the 'button i of this card of this stack'. If you issue that command from another card it will fail because Rev does not know where to find your buttons (tested). Of course the same holds true for another stack. What happens if you change all references to your button to: button x of card y. Or if you call it from another stack to
button x of card y of stack z.
edit:
you have to do 2 repeat loops
1 that loops through the cards
and 1 that loops through the buttons.
repeat with k = 1 to the number of cards
repeat with i = 1 to the number of buttons of card k
if the short name of button i of card k contains "Track" then
set the hilite of button i of card k to false
end if
end repeat
end repeat
Ahh Thanks Bernd...that makes perfect sense. I'm kicking myself as I was going to ask what the value of "i" was in an earlier thread Then I would have understood a bit better not to use "i" That stack you did is excellent for learning mate!!! Thank you.
AS I'm slowly going through it I am discovering certain areas where I do get stuck, for instance. When you load a library of sounds into one card the Track buttons on other cards do not load. They have to be individually loaded from each card. I am looking into working out a loop to do this. I am new to loops
repeat with k = 1 to the number of cards
repeat with i = 1 to the number of items of tButtonList
set the label of button (item i of tButtonlist) to line i of field "AudioNames"
end repeat
end repeat
bidge,
I dont quite get what you are trying to do.
repeat with k = 1 to the number of cards
repeat with i = 1 to the number of items of tButtonList
set the label of button (item i of tButtonlist) to line i of field "AudioNames"
end repeat
end repeat
You dont do anything with the variable k.
You have to tell rev exactly which button you mean.
What is in the tButtonlist?
regards
Bernd
If the sharedHilite of your buttons is false, you need to set the hilite of each button on each card separately. I believe you got that right already, but when you run the repeat loop (above), the script still look for the button on the current card and does that number of cards times. To refer to each button on each card, you need to write "button (item 1 of tButtonList) of cd k).
repeat with k = 1 to the number of cards
repeat with i = 1 to the number of items of tButtonList
set the label of button (item i of tButtonlist) of cd k to line i of field "AudioNames"
end repeat
end repeat
This assumes that the current stack is the stack containing the buttons and cards. If not, then you stillneed to add a reference to the right stack.
Best regards,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Can I ask a very basic question? In your code does "cd" stand for card?
I ask because I notice in some scripts there are shorcuts made, ie, "field" and "fld". Is it wise to use shortcuts or preferrable to use the correct spelling?
what is in i?
put this into a button and than look at the message box that will appear.
Make shure to understand what you are seeing and how it is done
on mouseUp
repeat with k = 1 to 3
repeat with i = 1 to 10
put k into message box
put return & i after message box
wait 1 second
end repeat
end repeat
end mouseUp
yes cd is the abbreviation of card. You can look up the synonyms in the dictionary:
But what is it supposed to do?
When you import more then the seven tracks should they overflow into the next card?
If you want to do an export should the selections of card 1 and card 2 be appended into one file?
Or do you want the selection on card 1 to be independent of the selections on card 2?.
Do you have a maximum of wav files you want to import or could it be more than 14 (7 on each card)?
regards
Bernd
Hi Bend.
It would be great to be able to mix all cards...so you could have different styles to pick from. I hav'nt tried mixing from seperate cards yet. I suppose that was going to be the next stumbling block It would be good to have as many styles as possible.
on mouseUp
answer folder "choose folder with audio files of type .wav"
if it is empty then exit mouseUp
put it into tFolder
put the defaultfolder into tOldDefault
set the defaultfolder to tFolder
put the files into tFiles
set the defaultfolder to tOldDefault
filter tFiles with "*.wav"
put tFiles into field "AudioNames"
repeat with i = 1 to the number of lines of tFiles
put tFolder & "/" before line i of tFiles
end repeat
put tFiles into field "AudioNamesAndPathes"
put empty into tbuttonList
repeat with i = 1 to the number of buttons
if name of button i contains "Track" then put the name of button i & comma after tbuttonList
end repeat
delete last char of tButtonlist
sort items numeric of tButtonlist by last word of each
put empty into tButtonListCard2
repeat with i = 1 to the number of buttons of card 2
if name of button i of card 2 contains "Track" then put the name of button i of card 2 & comma after tButtonListCard2
end repeat
delete last char of tButtonListCard2
sort items numeric of tButtonListCard2 by last word of each
put the number of lines of field "AudioNames" into tSoManyTracks
if tSoManyTracks > 7 then
answer "only the first 7 tracks will be put on this card. and on card the rest from track 8 up to 14 and on card 2."
end if
## we have more then 7 tracks, import first into card 1 and the rest up to #14 into card 2
if the number of lines of field "AudioNames" > 7 then
repeat with i = 1 to the number of items of tButtonList
set the label of button (item i of tButtonlist) to line i of field "AudioNames"
end repeat
put tSoManyTracks - 7 into tTracksRemaining
if tTracksRemaining > 7 then put 7 into tTracksRemaining
repeat with i = 1 to tTracksRemaining
set the label of button (item i of tButtonListCard2) of card 2 to line i + 7 of field "AudioNames"
end repeat
else ## less then 7 so the old routine
repeat with i = 1 to the number of items of tButtonList
set the label of button (item i of tButtonlist) to line i of field "AudioNames"
end repeat
end if
end mouseUp
I did not change anything on the export side, it will probably fail. Not if you do the export from card 1 though. Be careful. But you will fix that.
What I did is I set the sharedText to true for the 3 fields in your background group.