lunedì 16 gennaio 2017

Creare un menu che ricorda la scelta precedente

Quando usiamo un bottone tipo pulldown menu, potrebbe farci comodo far vedere all'utente quale opzione è selezionata, nel caso lo avesse premuto per errore.
Il seguente codice aggiunto ad un pulldown menu crea questo effetto:
Chiaramente potete scegliere qualsiasi carattere:

on menuPick pItemName
   DoMyCheckMark pItemName
   switch pItemName
      #your code here
   end switch
end menuPick

on DoMyCheckMark pLabel   
   if pLabel = empty then exit DoMyCheckMark
   put   numTochar(49851) into myMark
   put the text of the target into tPrevText
   replace myMark with empty in tPrevText
   replace myMark with empty in pItemName
   put lineoffset(pLabel & cr, tPrevText & cr) into tMH
   put myMark before line tMH of tPrevText
   set the text of the target to tPrevText
end DoMyCheckMark


In questo modo potete crearvi dei menu personalizzati senza dover utilizzare il menu builder.

Nessun commento:

Posta un commento