Adding 'alt-action to a text-list
[1/3] from: reboler::programmer::net at: 7-May-2002 14:12
Is there a way to add an 'alt-action to each face of a 'text-list? The usual way (see code below) does not work. directory-function-choices: [ ["make-dir"] ["remove-dir"] ] main: layout [ my-list: text-list [print value][ request-list/offset rejoin ["Directory Functions - " value] directory-function-choices 100x100 ] data directory-function-choices ] view main
[2/3] from: brett:codeconscious at: 9-May-2002 0:11
> Is there a way to add an 'alt-action to each face of a 'text-list?
Sorry about the delay. Text-list as it stands does not have the ability to do alt-actions. So I have added it. Here I am creating a new style based on the existing text-list style, but with the ability to do right-click actions. Alternatively if you change "text-list-rc" to just "text-list" it will modify the existing style. I developed it under View 1.2.1 - not tested against the beta. stylize/master [ text-list-rc: text-list with [ append init [ alt-act: :alt-action iter/feel: make iter/feel [ engage: func [f a e] [ if a = 'down [ if cnt > length? head lines [exit] if not e/control [f/state: cnt clear picked] alter picked f/text do :act slf f/text ] if a = 'alt-down [ if cnt > length? head lines [exit] if not e/control [f/state: cnt clear picked] alter picked f/text do :alt-act slf f/text ] if a = 'up [f/state: none] show pane ] ] ] ] ] view layout [ text-list-rc data copy system/locale/months [print now] [print face/picked] ] Regards, Brett.
[3/3] from: anton:lexicon at: 17-May-2002 17:33
You are going to have to patch text-list init block. If you do: print mold get in get-style 'text-list 'init you can see that there is only mention of action facet (stored in 'act). You need to copy the alt-action in a word (I suggest 'alt-act), and modify the engage function that you see there. Just add some lines similar to the 'down and 'up actions: ... if a = 'alt-down [...] if a = 'alt-up [...] You might need to bind your block into: get in get-style 'text-list 'self (But I am not a bindologist yet, so just see if it works.) After all this, alternative actions should work on text-lists. Anton.