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

default offset

 [1/5] from: patrick::philipot::laposte::net at: 3-Oct-2003 10:31


Hi List, A question about view. view layout [box blue 100x100] This code opens a windows at offset 50x4 (approximatively - vue de nez as we, french, say). It's bothering me because (1) my Windows menu bar is already there, (2) the top of the Rebol window is hidden. (In my own program, I always use "view center-face".) I guess 'view use some default value, but I have not find where it is. Regards Patrick

 [2/5] from: SunandaDH:aol at: 3-Oct-2003 4:44


Patrick:
> It's bothering me because (1) my Windows menu bar is already there, (2) the > top of the Rebol window is hidden. (In my own program, I always use "view > center-face".)
The default on my system is 25x25 -- don't know where it is stored, but you can easily check with something like this:
>> view mylayout: layout [box blue 100x100]
(escape)
>> mylayout/offset
== 25x25 If you want a window to start somewhere relative to your screen geometry, play around with something like this: unview/all view/offset layout [box blue 100x100] system/view/screen-face/size / 3 or even: forever [ unview/all view/new/offset layout [box blue 100x100 [halt]] random/secure system/view/screen-face/size wait 1 ] system/view/screen-face/size is your monitor's resolution. Sunanda.

 [3/5] from: g:santilli:tiscalinet:it at: 3-Oct-2003 10:50


Hi patrick, On Friday, October 3, 2003, 10:31:11 AM, you wrote: p> I guess 'view use some default value, but I have not find where it is. Use the SOURCE, Luke!
>> source view
view: func [ "Displays a window face." view-face [object!] /new "Creates a new window and returns immediately" /offset xy [pair!] "Offset of window on screen" /options opts [block! word!] "Window options [no-title no-border resize]" /title text [string!] "Window bar title" /local scr-face ][ scr-face: system/view/screen-face if find scr-face/pane view-face [return view-face] either any [new empty? scr-face/pane] [ view-face/text: any [ view-face/text all [system/script/header system/script/title] copy "" ] new: all [not new empty? scr-face/pane] append scr-face/pane view-face view-face/feel: window-feel ] [change scr-face/pane view-face] if offset [view-face/offset: xy] if options [view-face/options: opts] if title [view-face/text: text] show scr-face if new [do-events] view-face ] So the default is the offset of the face you provide. If you use LAYOUT, inside it (at the beginning) there's: if not parent [new-face/offset: any [all [offset where] either all [(system/version/4 = 2) (system/version/5 <= 3)] [25x50] [25x25] ]] Regards, Gabriele. -- Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer Amiga Group Italia sez. L'Aquila --- SOON: http://www.rebol.it/

 [4/5] from: patrick:philipot:laposte at: 3-Oct-2003 11:46


Brilliant Gabriele! Thanks Patrick

 [5/5] from: antonr:iinet:au at: 4-Oct-2003 15:52


First of all examine the source of layout: ?? layout ... Near the top we see the code Gabriele pointed out, below. The paths to those two default, offsets are:
>> pick pick pick second :layout 10 3 6
== [25x50]
>> pick pick pick second :layout 10 3 7
== [25x25]
>> system/version
== 1.2.10.3.1 Hmm, so the second one is used in my rebol version. Let's change the code:
>> poke pick pick second :layout 10 3 7 [420x190]
== [all [offset where] either all [(system/version/4 = 2) (system/version/5 <= 3)] [25x50] [420x190] ] Now test: view layout [button] ; (window appears at offset 420x190) This is a way to change the default window position (that layout gives you anyway.) Anton.