Hi... I'm trying to store a NoteHead's position (by using scheme functions) to be abble to use this value after (as a string in a markup)... To do that I define a variable (myvar with the string "init") and then I use tweak to set! myvar to its new value...

But when I call myvar from a markup, it still finds the old argument "init"...

Why?
Is it possible to do something like what I am trying to do in another way?

Thank you,
josé

code:
\version "2.13.22"

#(define myvar "init")

#(define (notehead-get-staffposition notehead)
   ;; notehead is grob
   (ly:grob-property notehead 'staff-position))

#(define (change-myvar notehead)
   ;; notehead is grob
   (let ((sp (ly:number->string (notehead-get-staffposition notehead))))
     (format #t "~2&~a\n" (make-string 40 #\-))
    (begin
     (format #t "~a\n" sp)
     (set! myvar sp))))

\relative c' {
  c1^\markup{\text \myvar}

  \once \override NoteHead #'before-line-breaking = #change-myvar
  c
  g^\markup{\text \myvar}
  a^\markup{\text \myvar}
}

--
http://zepadovani.info


_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to