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

Simple VID window style

 [1/2] from: atruter::hih::com::au at: 17-Apr-2002 11:52

Some folks may find the following of use . . . (or at least as a basis for something more elegant / complex). <code> REBOL [] stylize/master [ bar-title: text with [ size: 24x24 font: [size: 14 valign: 'middle] feel: make feel [ engage: func [face action event] [ if action = 'down [ face/data: event/offset face/help: face/parent-face/size face/parent-face/size: face/size show face/parent-face ] if event/type = 'move [ face/parent-face/offset: face/parent-face/offset + event/offset - face/data show face/parent-face ] if action = 'up [ face/parent-face/size: face/help show face/parent-face ] ] ] ] bar-close: button 24x24 "X" bold #"^(ESC)" ] display: make object! [ window-title: none window: func [title block /local pos] [ insert block [pad 24 across] insert tail block compose/deep [ pos: at origin 0x20 space 0 at 0x0 window-title: bar-title white navy (title) bold pos/x - 12 bar-close [unview] ] view/options center-face layout block [no-title] ] title: func [text] [window-title/text: text show window-title] ] display/window "Simple VID window style" [ title "Click & drag title bar" return button "Change title" [display/title form now/time/precise] return label "Restrictions:" return text "1. Direction must end as 'across'" return text "2. 'origin' will confuse it" return text "3. Largest (or equal largest) face must be last" ] </code> Regards, Ashley *****************Privacy, Confidentiality & Liability Notice ************ This email is intended for the named recipient only. The information contained in this message may be confidential, or commercially sensitive. If you are not the intended recipient you must not reproduce or distribute any part of this email, disclose its contents to any other party, or take any action in reliance on it. If you have received this email in error, please contact the sender immediately. Please delete this message from your computer. You must scan this email and any attached files for viruses. The company accepts no liability for any loss, damage or consequence, whether caused by our own negligence or not, resulting directly or indirectly from the use of any attached files. Any views expressed in this Communication are those of the individual sender, except where the sender specifically states them to be the views of the Company. **************************************************************************

 [2/2] from: atruter:hih:au at: 18-Apr-2002 12:09

Note to self, a much cleaner way to implement this is: <code> display: func [title block /local win-title win-close win-layout] [ insert block [pad 24] insert tail block compose [ at 0x0 win-title: bar-title white navy (title) bold at 0x0 win-close: bar-close [unview] ] win-layout: layout block win-title/size/x: win-layout/size/x - 24 win-close/offset/x: win-title/size/x view/options center-face win-layout [no-title] ] display "Simple VID window style v2" [ title "Click & drag title bar" label "Gotchas" text 200 { The title bar is inserted into a 24 deep gap at the top of the layout. As such, any 'word that positions faces relative to the top of the layout will need to be adjusted. Such words include 'origin, 'return, and 'at. } ; Example of adjusted return return pad 24 title green "Column Two" area 200 ] </code> This avoids being dependent upon the current direction ('below or 'across) and makes the title width calculation independent of the last face. I also have a simple "tooltip" style working, holler if you're interested and I'll post that too. Regards, Ashley