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

newline and alert

 [1/4] from: Patrick::Philipot::laposte::net at: 19-Oct-2005 13:43


Hi List How to make a two lines message with alert? See str: rejoin ["line1" newline "line2" newline] Print str line1 line2 but alert str ; shows only one line -- Regards Patrick

 [2/4] from: antonr:lexicon at: 19-Oct-2005 22:16


Ah yes, I bashed my head against this a while back. The reason is the TEXT style used by REQUEST function (used by ALERT). Compare the difference: view layout [text "hello^/there"] view layout [text "hello^/there" as-is] We must ask that REQUEST be patched to add the AS-IS keyword, I think. Anton.

 [3/4] from: greggirwin::mindspring::com at: 19-Oct-2005 10:56


AR> We must ask that REQUEST be patched to add the AR> AS-IS keyword, I think. Or just do a "quick" patch. I say "quick" because I thought it would take no more than a couple minutes. Took a bit longer because there's a line in the middle of REQUEST that calls LAYOUT, and that was trimming the string, so I was confused for a while as to why my patch didn't work. It's not well thought out or anything, but if you need it, it might do for now. -- Gregg (watch for wrap) request: func [ "Requests an answer to a simple question." str [string! block! object! none!] /offset xy /ok /only /confirm /type icon [word!] {Valid values are: alert, help (default), info, stop} /timeout time /as-is /local lay result msg y n c width f img rtn y-key n-key ][ rtn: func [value] [result: value hide-popup] icon: any [icon all [none? icon any [ok timeout] 'info] 'help] lay: either all [object? str in str 'type str/type = 'face] [str] [ if none? str [str: "What is your choice?"] set [y n c] ["Yes" "No" "Cancel"] if confirm [c: none] if ok [y: "OK" n: c: none] if only [y: n: c: none] if block? str [ str: reduce str set [str y n c] str foreach n [str y n c] [ if all [found? get n not string? get n] [set n form get n] ] ] width: any [ all [200 >= length? str 280] to-integer (length? str) - 200 / 50 * 20 + 280 ] ; Str gets trimmed here if we don't copy it. ; What does this line do anyway? ;layout [f: text bold to-pair reduce [width 1000] copy str] img: switch/default :icon [ info [info.gif] alert [exclamation.gif] stop [stop.gif] ] [help.gif] result: copy [ across at 0x0 origin 15x10 image img pad 0x12 guide msg: text as-is bold black copy str to-pair reduce [width -1] return pad 4x12 ] either as-is [ remove/part find result 'to-pair 3 ][ remove find result 'as-is ] y-key: pick "^My" found? ok n-key: pick "^[n" found? confirm append result pick [ [key #"o" [rtn yes] key #" " [rtn yes]] [key #"n" [rtn no] key #"c" [rtn none]] ] found? ok if y [append result [btn-enter 60 y y-key [rtn yes]]] if n [append result [btn 60 silver n n-key [rtn no]]] if c [append result [btn-cancel 60 c escape [rtn none]]] layout result ] result: none either offset [inform/offset/timeout lay xy time] [inform/timeout lay time] result ] alert: func [ {Flashes an alert message to the user. Waits for a user response.} str /as-is ][ either as-is [ request/ok/type/as-is str 'alert ][ request/ok/type str 'alert ] ] alert/as-is "^/this is a test^/^/this is only a test"

 [4/4] from: antonr::lexicon::net at: 20-Oct-2005 17:40


I think that line might have been an old method for determining the size of the text before the final layout. A quick look and I didn't see any references to 'f from View 1.2.1 onwards. Anton.