I'm pretty sure it can't be done but just checking.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
I'm pretty sure it can't be done but just checking.
I'm working on a music type app which concentrates on the development of lyrics, not music, and I'm happy with all the text stuff etc. It works by cloning cards as new projects and putting the titles of the project into a scrolling field where a user can navigate to the project etc. etc. All the controls for manipulating everything is contained in the master card that gets cloned. But the desire to add some limited musical functionality has crept in (sound of sad violin).
I've settled on a simple label object eg. 'A' in screenshot (that strums a guitar chord on mouseDown) and to create multiple instances, are cloned. Target distribution is to experienced musicians so no chord diagrams are necessary.
on mouseDown
play GA.aif
grab me
end mouseDown
on mouseDoubleDown
clone me
set the loc of me to "756,301" ## keeps it clear of the other chords, kinda like a drop zone
end mouseDoubleDown
The 'grab' me was included to allow a user to drag it over a scrolling text field where the lyrics are double-line spaced and the 'clone' script is working as expected ie. there are multiple instances of a single chord that plays the .aif when mouseDown(ed) but they are 2 separate objects and if the text field scrolls, the chord doesn't move. I've done a fair bit of searching but I can't seem to find a way to "bind" the chord to its position in the text.
The 'loc' command is a bit messy too because the 'master' object dutifully puts the cloned object into position 'loc' but because it's now populated with the cloned object can't go to the 'loc' so skips a few pixels down and to the right instead.
A small particle of lead behind my left ear might put me out of my misery.
I've settled on a simple label object eg. 'A' in screenshot (that strums a guitar chord on mouseDown) and to create multiple instances, are cloned. Target distribution is to experienced musicians so no chord diagrams are necessary.
on mouseDown
play GA.aif
grab me
end mouseDown
on mouseDoubleDown
clone me
set the loc of me to "756,301" ## keeps it clear of the other chords, kinda like a drop zone
end mouseDoubleDown
The 'grab' me was included to allow a user to drag it over a scrolling text field where the lyrics are double-line spaced and the 'clone' script is working as expected ie. there are multiple instances of a single chord that plays the .aif when mouseDown(ed) but they are 2 separate objects and if the text field scrolls, the chord doesn't move. I've done a fair bit of searching but I can't seem to find a way to "bind" the chord to its position in the text.
The 'loc' command is a bit messy too because the 'master' object dutifully puts the cloned object into position 'loc' but because it's now populated with the cloned object can't go to the 'loc' so skips a few pixels down and to the right instead.
A small particle of lead behind my left ear might put me out of my misery.
If we're treading on thin ice, well you might as well dance.
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: I'm pretty sure it can't be done but just checking.
Hi.
If i understand your issue, why not put a "scrollBarDrag" handler in the scrolling field, and set the vLoc of the draggable field to track?
Also, you want to use the largest caliber, not the smallest.
Craig
If i understand your issue, why not put a "scrollBarDrag" handler in the scrolling field, and set the vLoc of the draggable field to track?
Also, you want to use the largest caliber, not the smallest.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: I'm pretty sure it can't be done but just checking.
I made a small test stack. It has a scrolling field named "xxx" with many lines, and a single word in each line. One of the lines near the middle is "hhh". I made a small label field (field 2) and placed it inside the scrolling field. I explicitly set the textHeight of the scrolling field to 16. This is in the script of the scrolling field:
The label field tracks the line containing "hhh" when you scroll.
Craig
Code: Select all
on scrollbarDrag
set the top of fld 2 to the top of me + (lineOffSet("hhh",fld "xxx") * the textHeight of fld "xxx"\
- the scroll of fld "xxx") - the textHeight of fld "xxx" * 2
end scrollbarDrag
Craig
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: I'm pretty sure it can't be done but just checking.
Me again.
Of course you will have to do some clean-up, especially when the line of interest scrolls out of sight; the tracking label field must be hidden in that situation. There might just be other things that are needed to make this work the way you like it. And all this assuming I understood your original point.
Craig
Of course you will have to do some clean-up, especially when the line of interest scrolls out of sight; the tracking label field must be hidden in that situation. There might just be other things that are needed to make this work the way you like it. And all this assuming I understood your original point.
Craig
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: I'm pretty sure it can't be done but just checking.
Yet another possibility is the following if you want a really simple solution.
Use a monospaced font (e.g. Monaco) for the field and type the "chord"-chars where you wish to have them, for example
Use ONE textsize only so that the spacing is not disturbed.
You could use colors instead, for example
Use a monospaced font (e.g. Monaco) for the field and type the "chord"-chars where you wish to have them, for example
Code: Select all
A E7 D
This is some sample text. Don't
A
sing it too fast.
You could use colors instead, for example
Code: Select all
repeat with i=1 to (the num of lines of fld "out") div 2
set foreColor of line 2*i-1 of fld "out" to "blue"
end repeat
shiftLock happens
Re: I'm pretty sure it can't be done but just checking.
It actually sounds like you need ChordPro functionality. That stores chords inline in a text format. Then there are programs that render it with chords over lyrics.
Monospaced font is the easiest way though, you just end up with a bunch of spaces and when you edit lyrics the chords don’t move automatically.
Monospaced font is the easiest way though, you just end up with a bunch of spaces and when you edit lyrics the chords don’t move automatically.
Brian Milby
Script Tracker https://github.com/bwmilby/scriptTracker
Script Tracker https://github.com/bwmilby/scriptTracker
-
- VIP Livecode Opensource Backer
- Posts: 9669
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: I'm pretty sure it can't be done but just checking.
I guess I missed this completely. It is not at all about having a control track a particular line as a field scrolls vertically?but they are 2 separate objects and if the text field scrolls, the chord doesn't move. I've done a fair bit of searching but I can't seem to find a way to "bind" the chord to its position in the text.
Craig