Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

current face?

 [1/9] from: gchiu:compkarori at: 2-May-2001 20:39


Is there an object that identifies the current face that has been left clicked? -- Graham Chiu

 [2/9] from: petr:krenzelok:trz:cz at: 2-May-2001 10:58


Graham Chiu wrote:
> Is there an object that identifies the current face that has > been left clicked?
there is 'state field in face object. It is used with buttons, to identify it's state, but I think there is no general 'state field thru all styles. There is also some system/view/focal-face item, but I don't know how and when it is used ... -pekr-

 [3/9] from: scott::dunlop::nextel::com at: 2-May-2001 17:21


I may have missed if there was a response to this. You can determine the currently focussed face from [system/view/focal-face]. Does this help? --Scott.

 [4/9] from: gchiu:compkarori at: 6-May-2001 22:47


On Wed, 2 May 2001 17:21:45 -0400 "Dunlop, Scott" <[Scott--Dunlop--nextel--com]> wrote:
> I may have missed if there was a response to this. You > can determine the > currently focussed face from [system/view/focal-face]. > Does this help? > --Scott.
Hi Scott, Doesn't seem to. If I have view layout [ button "Some text" [ print system/view/focal-face/text ] ] and click on the button, it doesn't print do what I was hoping ... -- Graham Chiu

 [5/9] from: carl:rebol at: 6-May-2001 10:05


view layout [ button "Some text" [ print face/text ] ]

 [6/9] from: arolls:bigpond:au at: 7-May-2001 3:13


> > currently focussed face from [system/view/focal-face]. > > Does this help?
<<quoted lines omitted: 4>>
> and click on the button, it doesn't print do what I was > hoping ...
I don't think buttons can have the focus. If you change it to field then it will work. From your earlier post I think you need to be able to detect the button. What situation are you in where you need to detect this? (Perhaps we could solve the problem another way.) Or maybe you could stylize each gadget you need to detect and have it alter a global word to point to its face when it is manipulated. Anton.

 [7/9] from: gchiu:compkarori at: 7-May-2001 7:44


On Sun, 6 May 2001 10:05:00 -0700 "Carl Sassenrath" <[carl--rebol--com]> wrote:
> view layout [ > button "Some text" [ print face/text ] > ]
Doesn't work for me in this example Rebol [] ; modified from easyVid show-example: func [ currentface ] [ xy: 10x20 print join "face text is: " face/text if value? 'xview [xy: xview/offset unview/only xview] xcode: load/all currentface/text if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all ; check to see if xcode includes the 'layout word. If it does, ; then move past it if here: select xcode 'layout [xcode: here] if error? try [ xview: view/new/offset layout xcode xy ] [ alert "Unable to view this code" ] ] view center-face layout [ backdrop white ex1: text as-is { button "this works" } [ show-example ex1 ] ] -- Graham Chiu

 [8/9] from: brett:codeconscious at: 7-May-2001 11:16


Hi Graham, I think Carl's example script was meant to highlight that the problem is already solved. When you create an action block for a style it becomes the specification block for a function that takes FACE as an argument. The face is the one you expect. This nice little solution guarantees you always get the correct face. Here I can show it: layout [ the-button: button "Some text" [ print face/text ] ] print mold get in the-button 'action So concisely, an action block is a function, FACE is an argument to this function and therefore face/text is a normal Rebol expression. To your script then. The reference to face/text is in the wrong spot - should be part of an action block on the "this works" button. Where it is now it should have been currentface/text. So I'll change the existing print and put a new one on the button. Also using this same technique of getting FACE as a parameter I can remove the need to label your example text style "ex1:" Here is the modified code: show-example: func [currentface] [ xy: 10x20 print join "face text is: " currentface/text if value? 'xview [xy: xview/offset unview/only xview] xcode: load/all currentface/text if not block? xcode [xcode: reduce [xcode]] ;!!! fix load/all ; check to see if xcode includes the 'layout word. If it does, ; then move past it if here: select xcode 'layout [xcode: here] if error? try [xview: view/new/offset layout xcode xy] [ alert "Unable to view this code"] ] view center-face layout [ backdrop white text as-is { button "this works" [ print join "face text is: " face/text ] } [show-example face] ] Cheers, Brett.

 [9/9] from: gchiu:compkarori at: 7-May-2001 15:39


On Mon, 7 May 2001 11:16:13 +1000 "Brett Handley" <[brett--codeconscious--com]> wrote:
> So concisely, an action block is a function, FACE is an > argument to this > function and therefore face/text is a normal Rebol > expression.
Hi Brett, Thanks for the explanation. You've saved my 'face :-) -- Graham Chiu

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted