Scrolling List Field

Mark Smith mark at maseurope.net
Tue Aug 15 19:31:48 EDT 2006


John, you might try using a more generalized approach. Create a  
handler in the script of your UkeTab stack (the mainstack)

on placeChord theChord,theFont
   put length(theChord) into chordLength
   put theChord after field "TabField" of me
   set the textFont of char (0 - chordLength) to -1 of fld "TabField"  
of me to theFont
end placeChord

then, in each button of the first sub-stack

on mouseUp
  placeChord "A","verdana" -- or whatever
end mouseUp

and in the button of the second sub-stack

on mouseUp
  placeChord value(the selectedLine of fld "ChordList"),the textFont  
of fld "ChordList"
end mouseUp

So what happens is that the placeChord handler is responsible for any  
and all text that needs to be put into fld "TabField", and you make  
use of the message path to avoid duplicating code all over the place.

Best,

Mark



On 15 Aug 2006, at 23:10, John Baxter wrote:

> Mark,
> The code works great for my listfield stack! The TabField on my  
> mainstack
> was displaying the ukefont, but when I clicked Insert on the chord  
> Palette,
> the chord was inserted without changing the existing text. Exacty  
> what I'm
> trying to do. But, I'm not sure what the code would be for the  
> other Palette
> with multiple buttons (all using the same font). When I click a  
> button, it
> changes all the text back to the ukefont.
> John
>
>
>
>
> On 8/15/06, Mark Smith <mark at maseurope.net> wrote:
>>
>> To do this, I think you'll have to explicitly set the textFont of the
>> text you have just placed in fld "TabField". The text you have placed
>> in the global variable "chord" has no font property - it is simply  
>> text.
>>
>> So you might put something like this at the end of the placeChord
>> handler:
>>
>> put length(chord) into chordLength
>> set the textFont of char (0 - chordLength) to -1 of fld "tabField" of
>> stack "UkeTab" to the textFont of fld "ChordList"
>>
>> Best,
>>
>> Mark
>>
>>
>> On 15 Aug 2006, at 18:59, John Baxter wrote:
>>
>> > Thanks for the help. You guys are great. I've got most everything
>> > working
>> > except for the font issue. I have a mainstack with a "TabField". I
>> > use this
>> > code:
>> >
>> > on openStack
>> >    put empty into field "TabField"
>> > end openStack
>> >
>> > I have two palettes, each one uses a different font.
>> >
>> > Palette1 - buttons use this code:
>> >
>> > on mouseUp
>> >    put "A" after field "TabField" of stack "UkeTab"
>> > end mouseUp
>> >
>> > Palette2 - scrolling list and insert button. Button uses this code:
>> >
>> > on mouseUp
>> >    global chord
>> >    put value(the selectedLine of fld "ChordList") into chord
>> >    placechord
>> > end mouseUp
>> >
>> > on placechord
>> >    global chord
>> >    if chord is "A" then
>> >    put "A" after field "TabField" of stack "UkeTab"
>> > end placechord
>> >
>> >
>> > What I'm trying to do is mix font styles in the mainstack field
>> > when I do
>> > the mouseUp from each Palette. I experimented with different code,
>> > but can't
>> > get the inserted characters to display in the proper font.
>> >
>> > [set text font of "A" to "ukefont"]  -- when I click a button on
>> > Palette1
>> > [set textfont of "A" to "ukechord"]  -- which I click Insert  
>> button on
>> > Palette2
>> >
>> > Thanks for any help or advise you have.
>> > _______________________________________________
>> > use-revolution mailing list
>> > use-revolution at lists.runrev.com
>> > Please visit this url to subscribe, unsubscribe and manage your
>> > subscription preferences:
>> > http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>
>
>
> -- 
> John Baxter
> http://www.mandozine.com
> http://www.mandotunes.com
>
> Mandozine Radio:  Tuned Locally - Played Globally
> http://www.live365.com/stations/mandozine
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list