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

[REBOL] Re: Find objects/functions and linking some faces

From: greggirwin:mindspring at: 23-May-2004 12:14

Hi Philippe, llff> 1/ how is it possible to get a brief listing of objects and functions including llff> in a script ? Parsing, testing word? or another "not documented" method ? Something like this? mark-my-words: context [ init: does [query/clear system/words] dump: does [ print ['Word tab 'Type tab 'Value] foreach word query system/words [ print [word tab type? get word tab mold get word] ] ] ] mark-my-words/init o: make object! [a: b: c: none] my-int: 23 I-have-issues: #this-is-my-biggest-issue fn: does [print "some fun now!"] mark-my-words/dump llff> 2/ I have a layout with a box 1 and a box 2 (same drag'n dropable style). llff> I want to draw a line (length = offset box1 - offset box2) beetwen my faces. llff> And after I would drag and drop any box, and see the other follow the first one llff> (like with hard link). I don't know of any examples for this, but I did something similar for a project some time back. Here are a few things that might be useful, but I can't say for sure: distance: func [a [pair!] b [pair!] /local tmp] [ tmp: a - b square-root add (power first tmp 2) (power second tmp 2) ] all-corners: func [ "Returns all corners of the rectangle given the upper-left and lower-right corners." ul [pair!] "The upper-left corner of the rectangle" lr [pair!] "The bottom-right corner of the rectangle" /local result ] [ result: make block! 4 repend result [ ul to-pair compose [(first ul) (second lr)] ;ur to-pair compose [(first lr) (second ul)] ;ll lr ] return result ] nearest-point: func [ "Returns the point nearest the specified point." pt [pair!] "The reference point" points [any-block!] "The points you want to check" /local result [pair!] ref-dist [decimal!] ] [ result: first points ref-dist: distance pt first points foreach p next points [ if (distance pt p) < ref-dist [ ref-dist: distance pt p result: p ] ] return result ] nearest-corner: func [ "Returns the corner of the retangle nearest the specified point." pt[pair!] "The reference point" ul[pair!] "The upper-left corner of the rectangle" lr[pair!] "The bottom-right corner of the rectangle" ] [ nearest-point pt all-corners ul lr ] To move things, you basically need to see if the action in feel/engage is 'over or 'away, then just adjust things accordingly. In your case that will mean keeping lists of linked faces of course. -- Gregg