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

feel engage not 'feeling' to well......

 [1/3] from: jfdutcher1958::yahoo::com at: 16-Jun-2004 17:46


Here is an example of attaching a 'feel' to a field....... The 'return event' is over used of course....but I'm groping for an alternative. The one line, and only line, that actually 'works' religiously' ?? is the test for digits ... (if not find "0123456789" ch [alert "Only digits can be entered" return none] How to get the other events to actually pass through and be 'processed' ??? style numbox field 30x30 font [size:35] feel [engage: func[face action event] [ print event/type if event/type = 'key [ ch: event/key if ch = 'left [return event] if ch = 'right [return event] if ch = #"^-" [return event] if not find "0123456789" ch [alert "Only digits can be entered" return none] return event ] return event ] ]

 [2/3] from: nitsch-lists:netcologne at: 17-Jun-2004 3:15


view layout[ style numbox field 30x30 font [size:35] feel [engage: func[face action event /local pass] [ print event/type pass: does[ctx-text/edit/engage face action event] if event/type = 'key [ ch: event/key if ch = 'left [pass exit] if ch = 'right [pass exit] if ch = #"^-" [pass exit] if not find "0123456789" ch [ alert "Only digits can be entered" exit ] ] pass ] ] numbox ] On Donnerstag, 17. Juni 2004 02:46, John Dutcher wrote:

 [3/3] from: philb:upnaway at: 18-Jun-2004 10:34


Just to expand a litle more (adding 'home, 'end, select all, copy, cut, delete, backspace). my-styles: stylize [ rfield: field font [name: font-fixed] feel [engage: func[face action event /local pass] [ ; print event/type pass: does[ctx-text/edit/engage face action event] if event/type = 'key [ ch: event/key ; probe ch if ch = 'left [pass exit] if ch = 'right [pass exit] if ch = 'home [pass exit] if ch = 'end [pass exit] if find face/single-chars ch [if find face/data ch [exit]] if find "^A^C^H^X^~^-" ch [pass exit] if not find face/allow-chars ch [exit] ] pass ] ] with [allow-chars: "" single-chars: ""] ; decimal field dfield: rfield with [allow-chars: "0123456789.-" single-chars: ".-"] ; integer field ifield: rfield with [allow-chars: "0123456789-" single-chars: "-"] ;hexadecimal field hfield: rfield with [allow-chars: "0123456789ABCDEF#" single-chars: "#"] ; date field date-field: rfield with [allow-chars: "0123456789/" single-chars: ""] ] view layout [ styles my-styles style lab label 120 right backdrop 0.150.0 across lab "Decimal field" dfield return lab "Integer field" ifield return lab "Hex field" hfield return lab "Date (99/99/9999)" date-field return lab "Just ABCDEFG" rfield with [allow-chars: "ABCDEFG" single-chars: ""] ]