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

[REBOL] Re: draw has no access to the current face

From: gscottjones:mchsi at: 29-Sep-2002 13:04

From: "Gregg Irwin"
> Hi Patrick, > > << Unfortunately face/user-data is unknown in this block. > Is there a way to access the face object here? That is my question ! >> > > I don't think so. I'm certainly no guru in this area, but I just > compose/modify my draw blocks and update them myself, then show the face, > rather than putting dynamic elements directly in them for evaluation. > > I don't know if you want to do it in REDRAW though, since that can get > called quite a lot, generating a lot of data that needs to be recycled.
Hi, Patrick, (Gregg,) I agree with Gregg. You could use your basic idea, but let init do the swapping, since it is only called once. The only way that I am familiar with appending init is as follow: db: stylize [ draw-button: box 24x24 with [ effect: [ draw [pen black fill-pen x-color circle 12x12 10] ] user-data: 'white append init [ replace effect/2 'x-color user-data] ] ] draw-layout: [ styles db h2 "Draw buttons" across r-btn: draw-button [ print "hey, I'm red"] with [user-data: 'red] b-btn: draw-button [ print "hey, I'm blue"] with [user-data: 'blue] y-btn: draw-button [ print "hey, I'm yellow!"] with [user-data: 'yellow] g-btn: draw-button [ print "hey, I'm green!"] with [user-data: 'green] ] view center-face layout draw-layout Some other clever chap may know how to append init with the style form within a layout block. :-) --Scott Jones