• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

AltME groups: search

Help · search scripts · search articles · search mailing list

results summary

worldhits
r4wp204
r3wp3029
total:3233

results window for this page: [start: 2001 end: 2100]

world-name: r3wp

Group: Core ... Discuss core issues [web-public]
Geomol:
16-Apr-2009
And you can't see that file with list-dir inside REBOL?
eFishAnt:
16-Apr-2009
>list-dir ;after the file crashes...aha, I could see the files before 
doing the main.r.
main.r  main.r  


My scripts work fine on Windoze.  I am now thinking from this...I 
do a change-directory to get the directory of where I am running 
and I write my data into the current directory.  In Windoze, the 
change-directory seemed needed to pick up the directory I am in. 
 I'll bet 'nix doesn't like that, and perhaps needs the full pathnamem 
from the root, or soemthing like that.
amacleod:
17-Apr-2009
Is there a way to get the name of the drives besides just the letters.

>> list-dir %/
c/  d/  e/  f/  g/  h/  i/  j/

I want: Local Disk (c:), Removable Disk (G:) etc.
Group: View ... discuss view related issues [web-public]
Gabriele:
13-Sep-2006
in the detective, i had the same problem (but with network events 
coming). i just clear the wait list and show the inform. maybe you 
could also add a custom event func that filters events except for 
those regarding the popup.
Anton:
13-Sep-2006
error-window: layout [
	h3 "Program Error!"
	area 300x200
	button "Close" [hide-popup]
]

inform-on-error: func [code [block!]][
	if error? set/any 'error try code [
    	error-obj: disarm error
    	?? error-obj
		error-window/pane/2/text: rejoin [
			mold disarm error 
			now/time/precise
		]
    	either viewed? error-window [
    		; subsequent errors
    		show error-window
		][
			; first error
			
			print "INFORM"		
			;inform error-window
			; Emulate INFORM but without WAIT
			error-window/text: "Dialog"
			error-window/feel: make system/view/window-feel []
			show-popup center-face error-window
		]
	]
]

system/view/wake-event: func [
	port 
	/local event no-btn error ; <-- added 'error
] bind [
    event: pick port 1
    if none? event [

        if debug [print "Event port awoke, but no event was present."]
        return false
    ]
    either pop-face [

        if in pop-face/feel 'pop-detect [event: pop-face/feel/pop-detect 
        pop-face event]
        inform-on-error [do event]
        found? all [
            pop-face <> pick pop-list length? pop-list
            (pop-face: pick pop-list length? pop-list true)
        ]
    ] [
    	inform-on-error [do event]
        empty? screen-face/pane
    ]
] system/view

view/title layout [
	h3 "Avoid the console from popping up"

 box 500x100 "Hold down left mouse button and drag to create errors" 
 feel [
		engage: func [face action event] [
			print ["ENGAGE:" event/time event/type mold event/face/text]
			if find [over away] action [
				2 / 0 ; error!
			]
		]
	]
] "Main Window"
Henrik:
17-Sep-2006
I'm not wondering about it. I used Cyphre's video to kickstart LIST-VIEW 
development. :-) But I think this is an area of VID that remains 
a mystery to most users, as there is very little documentation around 
to explain how it works. Maybe that's why there isn't that many custom 
VID faces around. I seem to remember a ton of custom classes for 
MUI on the Amiga.
Louis:
16-Oct-2006
Ok, I have 61 out of 63 fields to clear, so it would be a lot easier 
to deal with those two that don't have to be cleared than to deal 
with the 61 that must be. So I propose a modification to the clear-fields 
function: Here is the source:

clear-fields: func [
    "Clear all text fields faces of a layout."
    panel [object!]
][
    if not all [in panel 'type panel/type = 'face] [exit]
    unfocus
    foreach face panel/pane [
        if all [series? face/text flag-face? face field] [
            clear face/text
            face/line-list: none
        ]
    ]
]
Sunanda:
17-Oct-2006
Does this do what you want?

clear-fields: func [
    "Clear all text fields faces of a layout."
    panel [object!]
    /except exceptions [block!]
][
    if not all [in panel 'type panel/type = 'face] [exit]
    unfocus
    if not block? exceptions [exceptions: copy []]
    exceptions: reduce exceptions
    foreach face panel/pane [

       if all [series? face/text flag-face? face field not find exceptions 
       face] [
             clear face/text
             face/line-list: none
             show face
         ]
      
    ]
]

;; test/ example
l-o: layout [
     a: field "A" b: field "B" c: field "C"
     button "clear c" [
         clear-fields/except l-o [a b]
         ]
     button "clear a" [
         clear-fields/except l-o [b c]
         ]
     ]

unview/all
view l-o
Maxim:
7-Nov-2006
its funny, cause I have a list of rants I never send out about REBOL. 
 I just accumulated them and see how over the years... they are similar. 
 Things in REBOL have not changed a lot.  R3 is the first really 
profound change since v1.2 core.  and its very welcome IMHO.
PhilB:
20-Nov-2006
How do I resize a text-list horizontally?
I tried this code
view layout/size [
    tl: text-list data ["A" "B" "C"]
    across

    btn "+" [tl/size: tl/size + 10x0 tl/sld/offset: tl/sld/offset + 10x0 
    show tl]

    btn "-" [tl/size: tl/size - 10x0 tl/sld/offset: tl/sld/offset - 10x0 
    show tl]
] 300x300
which works if the text-list is made smaller.
But if it's made bigger I get artifacts.
What else needs to be set in the text list to make it work?
Gregg:
20-Nov-2006
; how about using /resize, or stealing code from it?

view layout/size [
    tl: text-list data ["A" "B" "C"]
    across
    btn "+" [tl/resize/x: tl/size/x + 10  show tl]
    btn "-" [tl/resize/x: tl/size/x - 10  show tl]
] 300x300
Jerry:
9-Dec-2006
Gabriele, 

Actually, Oldes is right. Showing two-byte characters is good enough. 
IME is not necessary for REBOL/View, because every Chinese/Japanese/Korea 
OS has proper IMEs installed. IME sends the codes encoded in the 
OS codepage to the focused window. For Example, If the codepage used 
by Windows XP is Big5 and I type in the Character which means one 
( #{A440} in Big5, #{4E00} in Unicode, see http://www.unicode.org/cgi-bin/GetUnihanData.pl?codepoint=4E00
), my REBOL/View program will get two key events sequentially, which 
are #{A4} and #{40}. REBOL/View shows it as two characters instead 
of one. I hope that REBOL/View can let the OS do the text-drawing, 
like the REBOL/core console does. REBOL/core console doesn't have 
the Chinese-Character-Showing issue, because it basically send the 
#{A4} and #{40} to the console, and let the OS do the text-drawing. 
the OS knows that #{A4} and #{40} should be combine to one Big5 Character, 
so it just show it as one character. Of course, if I type in two 
ASCII characters, the OS is smart enough not to combine them into 
one "non-existing" Big5 Character. CJK encodings are supersets of 
ASCII, just like UTF-8 is a superset of ASCII.


It's nothing to do with Unicode, so it is not too difficult to fix, 
I guess. Please fix this in 2.7.5 or 2.7.6 please ... 

It's on my wish list for Santa Claus this year.
Jerry:
21-Dec-2006
For example, the left part of the "yung" Chinese character is "jin", 
meaning "gold" or "metal". The left part of any  metal-related character 
is exactually the same as the left part of "yung". There are hundreds 
of such characters. And "metal" is just an example, we also have 
"water", "fire", "soil", "bird", "dog", "hand", "human", "tree" ... 
this list goes on and one.
Janeks:
24-Jan-2007
Hi!
How to keep selection after show for text-list?

F.ex. code changes text-list data, for selected row, than after show 
a-text-list, selection of selected row disapears.
Pekr:
3-Feb-2007
Ah, then we are on the same wave. But I was not able to defend my 
opinion to e.g. Anton in the past :-) So surely rebollers will differ. 
For your own kind of style, e.g. animation, you might prefer current 
aproach. But I visited recently my friend, who started to learn Delphi 
some 2 months ago, and he already did nice app in it. The most missed 
feature of SDK is - no screen painter, lack of crucial styles, lack 
of proper style behavior (just try list-down here in AltME, you can't 
close it by clicking outside, esc, etc.?), and most ppl are really 
used to - on-double-click, on-left-click, on-over, whatever ...
Henrik:
3-Feb-2007
LIST-VIEW has a lot of different actions that let you set what it 
should do in particular situations easily. Every single VID element 
should have that. In fact there should be an abundance of placeholders 
for actions, every one that we can think of.
Sunanda:
12-Feb-2007
A just-in feedback message to REBOL.org:
<<

How to find the documentation for the use of VID and RebGUI} description: 
{Hi;

I find the RebGUI is good, but how can I find the help document for 
the use of this package?

the wewpages in the website donot tell people how to use his software.

How to find the detalied documentation for VID? like how to build 
botton, box, drop-list,combo list?

It seems Rebol is weak in teaching people about how to use the GUI.

Normally people like to learn software quickly, so a good help documentation 
is always welcome.
Thanks,
>>

Can someone give me a useful list of URLs to pass on to the enquirer? 
Thanks.
Pekr:
21-Feb-2007
Hi, has anyone any newer version of Todo List script? My intention 
is not to replace Qtask, just having something VERY easy, kind of 
check-list, for controlling tasks - http://www.xidys.com/rebol-view/image38.jpg
Brock:
6-Mar-2007
The current application (not my own) uses an HTML page to list all 
this information, but new versions of MS apps all open the .doc files 
in the browser window instead of launching Word.  The problem here 
is the .doc files contain macros that run when executed, but this 
does not happen through the browser.  The Word templates also get 
auto-updated if new versions are available, but this is handled by 
a secondary .exe file.
Anton:
11-May-2007
I suppose you could remove the event-port from the wait-list temporarily, 
until you get a result or a timeout occurs. (how to specify a timeout... 
?)
Anton:
11-May-2007
eg.
remove system/ports/wait-list system/view/event-port

do-service ...  ; <-- trap errors here so you don't block your gui 
forever
insert system/ports/wait-list system/view/event-port
Anton:
11-May-2007
Hmmm... maybe CLEAR event-port ? Or just COPY it until it's empty 
before adding it back to wait-list.
Anton:
11-May-2007
view layout [
	button "reset" [n: 0]
	button "read" [
		;remove find system/ports/wait-list system/view/event-port
		
		old-wake-event: get in system/view 'wake-event
		
		system/view/wake-event: func [port][
			while [pick port 1][] ; remove and ignore all queued events
			false
		]
		
		print n: n + 1
		probe length? read http://anton.wildit.net.au/rebol/index.html
		
		; clean queued events
		wait 0.0001
		
		system/view/wake-event: :old-wake-event
		
		;insert system/ports/wait-list system/view/event-port
	]
]
Arie:
1-Jun-2007
Does somebody know how to change the color of individual lines of 
a text-list?
Henrik:
1-Jun-2007
I believe that was the original reason I wrote LIST-VIEW :-)
Gregg:
1-Jun-2007
Can't do that with text-list, but you can with LIST. LIST-VIEW is 
very complete though. LIST is lower level.
Anton:
1-Jun-2007
view layout [
	text-list data ["hello" "there" "Arie"] with [
			append init [
				iter/feel: make iter/feel [
					redraw: func [face action into][
					iter/color: color

     ;if flag-face? slf striped [iter/color: pick next colors odd? cnt]
					iter/color: white / 4 * (1 + mod cnt 4)
					if find picked iter/text [iter/color: svvc/field-select]
				]
			]
		]
	]
]
Anton:
1-Jun-2007
I don't like text-list, though. I would rewrite it first.
amacleod:
28-Jun-2007
I making an app that requires a long pick list that will be contained 
in one of cyphre's tab panels that will be relativly narrow. ..so 
"Choice" will not work as the face is not large enough. I've tried 
rebol's drop-down but I can not see the whole widget. Are there refinements 
to this "widget" I can not find any docs on it. I have tried to use 
'Cyphre's drop-down but I am also using the list-view widget and 
htere sems to be some kind of conflict. I have also tried drop-down.r 
from hte library and it displays fine but I can not upate it to display 
waht I select in the list-view widget. Any thoughts?
Anton:
29-Jun-2007
Maybe this will help. 
http://anton.wildit.net.au/rebol/gui/demo-drop-down.r

But it sounds like the small size of the parent face (the tab panel) 
will clip the drop-down.

Actually yes, I think what you want to do is modify this function, 
so that the width of the drop-down list (which is a popup window) 
is not determined by the width of the drop-down face which popped 
it.
	print mold get in svv/vid-styles/drop-down 'show-dropdown
Anton:
29-Jun-2007
Here's a demo where the list width (300) is twice the width of the 
drop-down face (150):
Anton:
29-Jun-2007
my-data: ["hello" "there" "everyone" "have" "fun"]

view layout [
	size 400x400
	drop-down data my-data [hide-popup] 150 with [
		append init [

   change select select select second :show-dropdown [if not list-lay][list-lay: 
   layout][to-pair reduce] 300
		]
	]
]
james_nak:
21-Aug-2007
I know I saw that! I was thinking of just  using yours and adding 
that with the key action. BTW, the new List-View is great.
james_nak:
21-Aug-2007
Well, I just saw list-view get updated with the mysql data. How cool.
amacleod:
22-Aug-2007
the new list-view is great
? is there a new version available?
amacleod:
22-Aug-2007
I just saw list-view get updated with the mysql data
? Is there some mysql interface now in list-view?
Henrik:
22-Aug-2007
it supports object lists now. mysql views, I think he means that 
output from mysql-protocol.r fits in list-view.
amacleod:
22-Aug-2007
I've been using list-view with mysql-protocol for a while but the 
method I use to move data back and forth between mysql data and the 
list-view is not very elegant. Are there any examples of how object 
lists..mysql views work with list-view?
Henrik:
27-Sep-2007
but worse, I need it in a list and the popup is covered by the panel 
size.
james_nak:
27-Sep-2007
For those kinds of things I end up usinga thing call list-view : 
) or just the text-list when I can go lo-tech.
james_nak:
27-Sep-2007
Can you split the list up?
Henrik:
27-Sep-2007
it's a big vertical list of dropdowns
Brock:
27-Sep-2007
atleast I think  the list will span outside of the parent face.
james_nak:
27-Sep-2007
Yes,  and I guess it doesn't initially take up real estate like a 
text list would by default.
Brock:
28-Sep-2007
For the amount of help you have provided me with List-view, I still 
owe you alot!!
amacleod:
2-Dec-2007
I'm trying to add data to a drop-down widget, but I'm not able to 
get it to refresh to display the updated data list.
amacleod:
2-Dec-2007
I've probed the /data-list and it shows teh new data. I then "show 
: the widget but no luck.
amacleod:
2-Dec-2007
Also, when I clear fields of a form of which the drop-down is part, 
the item that was picked disappears from the drop-down list (but 
not the /daat-list its self.
Chris:
2-Dec-2007
;-- does this illustrate your setup?

view layout [
	dd: drop-down 150 "one" "two" "three"
	btn 150 "Add" [
		either tail? skip dd/list-data 3 [
			append dd/list-data ["four" "five"]
			face/text: "Remove" show face
		][
			clear skip dd/list-data 3
			face/text: "Add" show face
		]
	]

 btn 150 "Set" [set-face dd pick dd/list-data random length? dd/list-data]
]
Henrik:
20-Feb-2008
imagine a preferences window like in Amiga MUI: The left side is 
a list. The right side is a set of switchable panes.The bottom would 
be functioning OK/Save/Cancel buttons  If that is available as a 
standard window type with all the mechanics for switching, so you 
only need to fill out the list in the left side with titles and some 
GUI elements for each pane in the right, and then be able to use 
it.
james_nak:
4-Mar-2008
I'm using a single "area" right now to display a list of notes but 
would I like to do something like what we see here in Altme; that 
is, a scrollable list of rows that have differing heights. Any thoughts 
about how I can accomplish this feat? I tried list with supply but 
all I get is a bunch of areas the same height. I think that you cannot 
have such a thing with list/supply so there must be another trick.
Anton:
4-Mar-2008
James, it is quite difficult to make an iterated list of AREAs using 
LIST, retaining all the correct behaviour as expected for an AREA. 
I remember trying pretty mightily to achieve this, but, in the end, 
I have no example to show. If you were going to try, you would program 
the pane function directly yourself, rather than letting LIST use 
its default pane functions.

So I recommend the approach, as Graham above, of generating real 
faces (at least for the visible part of your list).
james_nak:
4-Mar-2008
Thanks to all of you for your input. That definitely puts me in the 
right direction (and keeps me from wasting any more time with "list".) 
 This morning I took a look at Carl's #29 cookbook and at least there's 
a fast way to get closer to what I'd like. I really appreciate your 
support.
amacleod:
2-Apr-2008
I'm trying to use Cypher's drop-down style but it seems to conflict 
with list-view widget. I keep getting: "dragger does not exist"

Anyone know a quick fix to drop-down so that it does not conflict?

skin-slider.r used by drop-down seems to redefine "dragger". I tried 
to rename all references but that did not work.
Henrik:
2-Apr-2008
I'll carry this on in LIST-VIEW.
Anton:
19-Apr-2008
Let me add that to the to-do list...
Is this a common case, by the way ?
Gregg:
25-May-2008
Does the line-list facet hold it?
Anton:
11-Jun-2008
Very nice work, Rebolek!

Nice GUI elements used; I like the rearrangement method used in the 
list of effects, and I see you've done some nice rotate knobs.
amacleod:
4-Aug-2008
I got Cypher's tree widget to work with Anton's scroll-panel...sort 
of. Problem was tree widget uses cypher's scroll-panel style which 
of course works diferently from Anton's. Now I'm forced to use both 
and the tree scroll-panel does not display sliders correctly. 

I'm going to either need to find a way for the tree list to use Anton's 
scroll-panel or add the extra functionality to cypher's scroll-panel 
style...or start from scratch.
BrettH:
8-Aug-2008
I have a similar problem re: scrolling, and I've tried the suggstions 
by amacleod without success, here I've copied a modified version 
of cookbook-scroller in the hope someone can suggest a solution.Hi, 
I'm trying to write a data entry form with many fields, this form 
is longer than a typical
monitor viewing area.

Creating the form is easy, but I cannot work out how to scroll the 
whole form 'up/down'

when the user TAB's out of the last showing field bottom and display 
the 'hidden' fields.

Rebol actually does TAB to the next field and accepts data entry 
but you cannot see it
without manually moving the scroll slider.


How do I programmatically make the form 'move' up/down ? and sync 
the slider ?

 I've tried "all" the example code I can find and none seem to do 
 the trick :-)


In the attached (modified cookbook-scroller.r) program I've added 
a few fields to illustrate the

problem. My need is for rapid data entry and using the mouse is really 
not a option, The program accepts user data, user TABS to navigate 
to next field, form slides as necessary, upon last field, data is 
saved, form cleared, cursor placed at first field, data entry continues.

Thanks for any ideas.

;; ===============================
  rebol ["cookbook-scroller2.r"]
  sub-panel: layout [
        across origin 5
        style label text bold right 60
        backcolor tan
        h2 leaf "Scrolling Sub Panel" return
        label "Name:" f1: field return
        label "Email:" f2: field return
        label "Info:" f3: area wrap return
        label "Month:"
        l1: text-list data system/locale/months return
        label "Day:" s1: slider 200x20 return
        label
        button "Submit"
        button "Cancel" [quit]
    ]

    out: layout [
        across
        h3 "Panel Scrolling Example" return
        space 0
        p1: box 300x300 coal frame black
        s1: scroller 16x300 [scroll-panel-vert p1 s1]
        return
        s2: scroller 300x16 [scroll-panel-horz p1 s2]
        return
    ]

    p1/pane: sub-panel

    scroll-panel-vert: func [pnl bar][
        pnl/pane/offset/y: negate bar/data *
            (max 0 pnl/pane/size/y - pnl/size/y)
        show pnl
    ]

    scroll-panel-horz: func [pnl bar][
        pnl/pane/offset/x: negate bar/data *
            (max 0 pnl/pane/size/x - pnl/size/x)
        show pnl
    ]

    update-panel: func [pnl vbar hbar] [
        pnl/pane/offset: 0x0
        s1/data: s2/data: 0
        vbar/redrag pnl/size/y / pnl/pane/size/y
        hbar/redrag pnl/size/x / pnl/pane/size/x
        show [pnl vbar hbar]
    ]

    update-panel p1 s1 s2
    view out
;; ============
amacleod:
8-Aug-2008
You will need to know the offset value of each face you tab into. 
You will also need to detect which ace is currently focused. (Do 
not know how is is done).

If you know these two things you can set the offset and "show" the 
face to junp to that location.


Also, I do not know if all faces can be tabbed into such as your 
month list face..
BrettH:
8-Aug-2008
Thanks for your input.


 I removed the Month list type and replaced with  fields. Tab does 
 visit each one in turn, and accepts data enty even tho their not 
 visible. ( until you slide)

eg:
        label "Name:" f1: field return
         label "Email:" f2: field return
         label "Info:" f3: area wrap return
	 label "More info: " f4: field return
	 label "Even more ;" f5: field return


As for the  'offset' info you mention, thats probably the key to 
the problem, and like you I have NO idea how

to get this !!  I've tried various code ideas attached to the TAB 
field exit without success.


I'm not trying to avoid mouse use , I just want to program the data 
entry flow for user comfort, 
the user should still be able  to use the mouse as needed.


I think REBOL is a very interesting product but it does seem to have 
many 'holes' in fundemental GUI handling :-),

on the one hand it offers the very easy to make GUI interface tool, 
then stuffs up drop-down-lists, sliders, TAB control,
etc.
Anton:
18-Aug-2008
I haven't programmed scrollers to be easily optional (though it's 
on to-do list).
Henrik:
13-Oct-2008
yes, I have a base face similar to vid-face. I even added it to the 
style list manually to see if that would work, but it doesn't.
amacleod:
4-Nov-2008
Is there a way to get an index # from a text list selection?
amacleod:
4-Nov-2008
text-list
DideC:
5-Nov-2008
text-list in R2 has this problem cause it works on text value, not 
index. So it can't handle the same text value several times.
VID 3.4 actually return the index AFAIK.
Nicolas:
21-Nov-2008
REBOL []

index: func [dir list /local files] [
	files: sort load dir
	foreach file files [append list join dir file]

 foreach file files [attempt [if find file "/" [index dir/:file list]]]
] index %/c/ files: []

l: layout [
	f: field 600 [call t/picked]
	t: text-list 600x400 data copy files] 

search: func [f-string] [
	t/data: copy files  

 foreach s parse f-string none [remove-each f t/data [not find f s]]
	show t]


append blk: select select second get in f/feel 'engage [switch act][key] 
bind [search f/text] blk/2

focus f view l



if I type something into the field, then I click the slider, it calls 
t/picked. Why? i can't figure it out.
Nicolas:
21-Nov-2008
index: func [dir list /local files] [
	files: sort load dir
	foreach file files [append list join dir file]

 foreach file files [attempt [if find file "/" [index dir/:file list]]]
] index %/c/ files: []

l: layout [
	f: field 600 [call t/picked]
	t: text-list 600x400 data copy files] 

search: func [f-string] [
	t/data: copy files  

 foreach s parse f-string none [remove-each f t/data [not find f s]]
	append clear t/picked t/data/1
	show t]


append blk: select select second get in f/feel 'engage [switch act][key] 
bind [search f/text] blk/2

append clear t/picked t/data/1
focus f view l



if I type something into the field, then I click the slider, it calls 
t/picked.
Anton:
21-Nov-2008
This is just the same as:
	view layout [
		field [call t/picked]
		t: text-list
	]
Anton:
21-Nov-2008
It's ON-UNFOCUS in face flags.  Compare:
	view layout [f: field [print "action"] text-list]
	print mold f/flags

 view layout [f: field [print "action"] with [deflag-face self on-unfocus] 
 text-list]
	print mold f/flags
Nicolas:
12-Dec-2008
does anyone know how to change the text-list highlight color?
Henrik:
12-Dec-2008
text-list is an iterated face, so you probably have to study how 
it paints each row.
Sunanda:
19-Dec-2008
A View problem:

rebol []
  unview/all
  view layout [button "butt" [request-list "req" [1 2 3]]]
  
Sequence:
1. run the above code

2. click "butt" to get the pop-up request list. Do not interact with 
it! instead:
3. return to the console window and hit esc
4. run the coee again

Result:
 a stuck window
 

Any ideas what I need to do in addition to the unview/all to disable 
whatever the request-list is waiting for?
Sunanda:
19-Dec-2008
Sadly, not -- at least not when used like this:

  rebol []
  unview/all
  hide-popup
  view layout [button "butt" [request-list "req" [1 2 3]]]
Sunanda:
20-Dec-2008
Thanks....But that still hangs for me under 2.7.6.

  rebol []
  hide-popup
  unview/all
  view layout [button "butt" [request-list "req" [1 2 3]]]


I'm actually tracking down a bug report from a live application .... 
I know it's an unlikely sequence of events, but someone out there 
tried it. It'd be good to have the magic to make it work when they 
try again :-)
Anton:
20-Dec-2008
WAKE-EVENT DO EVENT is normally expected (via some GUI action) to 
do HIDE-POPUP, and WAKE-EVENT usually

straight afterwards fixes up SYSTEM/VIEW/POP-FACE (ie. setting it 
to NONE when all requestors are closed).

However, when this process is interrupted in DO EVENT (by pressing 
Escape in the console),
then this fix-up is skipped, and POP-FACE remains set.

So HIDE-POPUP, issued at the console, will not fix POP-FACE (eg. 
set it to NONE).

This means the next VIEW -> WAKE-EVENT will act as if there is a 
requestor open, and return the wrong

result (FALSE, because the incorrect POP-FACE is not found in the 
correctly empty POP-LIST),
and therefore WAIT will return immediately.


The one-line solution seems to be to patch WAKE-EVENT to fix POP-FACE 
when it's not found in POP-LIST,
just before POP-FACE is checked.


 if all [pop-face not find pop-list pop-face][pop-face: none] ; <--- 
 Added by Anton. Fix POP-FACE when it's not found in POP-LIST (eg. 
 HIDE-POPUP was done at the escaped console, not by WAKE-EVENT DO 
 EVENT, as usual, here).
	either pop-face [ ...
Anton:
20-Dec-2008
system/view/wake-event: func [port /local event no-btn] bind [
    event: pick port 1
    if none? event [

        if debug [print "Event port awoke, but no event was present."]
        return false
    ]

 if all [pop-face not find pop-list pop-face][pop-face: none] ; <--- 
 Added by Anton. Fix POP-FACE when it's not found in POP-LIST (eg. 
 HIDE-POPUP was done at the escaped console, not by WAKE-EVENT DO 
 EVENT, as usual, here).
    either pop-face [

        if in pop-face/feel 'pop-detect [event: pop-face/feel/pop-detect 
        pop-face event]
        do event
        found? all [
            pop-face <> pick pop-list length? pop-list
            (pop-face: pick pop-list length? pop-list true)
        ]
    ] [
        do event
		empty? screen-face/pane
    ]
] system/view
Anton:
22-Dec-2008
To track it down, I patched all functions (and relevant, nested helper 
functions) involved in Sunanda's example code: VIEW REQUEST-LIST 
INFORM SHOW-POPUP HIDE-POPUP and finally WAKE-EVENT. I added 30 print 
statements to all those function bodies (making sure to bind them 
correctly etc), tracking the control flow, then compared the output 
before and after escape was pressed. Eventually I found the difference 
in control flow in wake-event (EITHER POP-FACE ...).
BenBran:
26-Jan-2009
I'm working on taking the output of a console program to a view. 
 Its formatted nice for the console but I can't seem to get the text 
spaced correctly for the text-list box such as teletype or monotype.... 
any suggestions?  

myData: read %./
lo: [text-list 640x480 data to-block myData]

view/options/title layout lo [resize] "Files"          ;; characters 
do not line up vertically but look fine in console

thanks in advance.
DideC:
26-Jan-2009
myData: read %./

lo: [text-list 640x480 data to-block myData font [name: "courier 
new"]]
view/options/title layout lo [resize] "Files"
Anton:
26-Jan-2009
or

my-data: read %./

window: center-face layout [text-list 640x480 font-name font-fixed 
data my-data]
view/options/title window 'resize "Files"
BenBran:
2-Feb-2009
I'm working with resizing fields.  Setting the size of the field 
would be a good start. Figuring how to size the text-list on a window 
resize event would be a bonus.
I took a sample from the docs and modifed slightly.

REBOL []


displayData: ["A very long entry that will exceed the default width 
of the field that is displaying it."]
view/options/title layout [

 lines: text-list 640x480 bold font-size 14 font-name font-fixed data 
 to-block displayData [  		;; not sure how to auto-size the text-list 
 either 

 see-it/text: first lines/picked										;; how do I size this field
	show see-it												;; maybe its done here  
	]													;;
	see-it: info												;; or here?								
] [resize] "Test"

Thanks again in advance.
Anton:
3-Feb-2009
http://anton.wildit.net.au/rebol/gui/demo-resize-text-list.r
Dockimbel:
31-Mar-2009
Try by searching for the window face in system/view/pop-list. If 
found there, then the window has been opened with INFORM or SHOW-POPUP.
Anton:
31-Mar-2009
Probably checking system/view/pop-list is all you need to do, but 
you can notice that face/options is different in normal windows vs 
pop-up windows.
Henrik:
22-Apr-2009
there is no window list for ordinary windows, like there is for INFORMs 
with system/view/pop-list?
TomBon:
23-Apr-2009
; I need 100 rows like these both samples with unshared data access 
for each row.

; I have also tried with stylize/master (panel with) to construct/compose 
a master 

; row like this but doesn't succeed. any change to make this work?


list-func: func [] [ layout/tight [across x: text "x"  y: text "y" 
z: progress 0.5   w: box 40x20 effect [ draw arrow blue rotate  60 
]   ] ]

view layout [
	a: box 300x50
	b: box 300x50
	do [a/pane: list-func]
	do [b/pane: list-func]

 btn "set a" [a/data: [x/text: "1" y/text: "2"  z/data: 0.8 w/effect: 
 [ draw arrow red rotate  180 ]   ]  show a ]

 btn "set b" [b/data: [x/text: "1" y/text: "2"  z/data: 0.8 w/effect: 
 [ draw arrow red rotate  180 ]   ]  show b ]

 btn "set"   [x/text: "1" y/text: "2"  z/data: 0.8 w/effect: [ draw 
 arrow red rotate  180 ] show b  ]
]

quit
TomBon:
23-Apr-2009
or how to supply data to a standard list containing progress and 
draw elements like this one above?
TomBon:
23-Apr-2009
view layout [
        below
        p-list: list 550x180 [
                across origin 2x2
                chk: 	check true 
		a1: 	text wrap 100
                a2: 	text wrap 100
		pg1: 	progress 40x20 0.5
		pg2: 	progress 40x20 0.2
		a3: 	text wrap 20
		arr-1: 	box 40x20 effect [ draw arrow red rotate  180 ]
        ] supply [
                if count > length? t [face/show?: false exit]
                face/show?: true
                face/text: t/:count/:index
		;; face/data: d/:count/:index
        ]
	
	btn "set" [ ] 
]
Gregg:
26-Apr-2009
LIST doesn't iterate styles that need state (IIRC). I would generate 
the layout dynamically and put the whole thing into a scrolling pane, 
unless that ends up being too slow or memory intensive.
Anton:
26-Apr-2009
I agree. It's very difficult to make a lot of styles behave properly 
when iterated by a LIST. (And I've tried, believe me.) It's better 
to make a window full of real faces and scroll your data through 
them yourself.
Gregg:
4-May-2009
REBOL []

; r/3 = 'activate = left-click
; r/3 = 'activate = rt-click+menu-item-sel

hex: func [
    {Returns the base-10 value of a hexadecimal number.}
    value [integer! string! issue!] "A hexadecimal number"
][

    ; Convert to an issue first, so integers can also be translated.
    to integer! to issue! value
]

make-elements: func [name count type /local result][
    if not word? type [type: type?/word type]
    result: copy "^/"
    repeat i count [
        append result join name [i " [" type "]" newline]
    ]
    to block! result
]

NOTIFYICONDATA: make struct! compose [
    cbSize  [integer!]
    hwnd    [integer!]
    uId     [integer!]
    uFlags  [integer!]
    uCallBackMessage [integer!]
    hIcon   [integer!]
    (make-elements 'szTip 64 #"@")  ; CHAR
] none
NOTIFYICONDATA/cbSize: length? third NOTIFYICONDATA

;change at third NOTIFYICONDATA 25 "New ToolTip!"
;probe NOTIFYICONDATA
;halt

;constants required by Shell_NotifyIcon API call:
NIM_ADD:     hex 0
NIM_MODIFY:  hex 1
NIM_DELETE:  hex 2
NIF_MESSAGE: hex 1
NIF_ICON:    hex 2
NIF_TIP:     hex 4
WM_MOUSEMOVE:       hex 200
WM_LBUTTONDOWN:     hex 201  ;   'Button down
WM_LBUTTONUP:       hex 202  ;     'Button up
WM_LBUTTONDBLCLK:   hex 203  ; 'Double-click
WM_RBUTTONDOWN:     hex 204  ;   'Button down
WM_RBUTTONUP:       hex 205  ;     'Button up
WM_RBUTTONDBLCLK:   hex 206  ; 'Double-click


;Public Declare Function SetForegroundWindow Lib "user32" (ByVal 
hwnd As Long) As Long

lib: load/library %shell32.dll

Shell_NotifyIcon: make routine! compose/deep [
    dwMessage [integer!]
    pnid      [struct! [(NOTIFYICONDATA)]]
    return:   [integer!]
] lib "Shell_NotifyIconA"


my-hwnd?: does [second get-modes system/ports/system [window]]

set-tray-tooltip: func [struct string] [
    change at third struct 25 string
    struct
]



system-awake: func [port /local evt][
    if all [evt: pick port 1  (evt/1 = 'tray)] [
        status/text: mold evt
        show status
;         if any [
;             (evt/3 = 'activate)
;             all [(evt/3 = 'menu)  (evt/4 = 'desktop)]
;         ] [
;             if not desktop-loaded [
;                 link-exec-start-desktop/force
;             ]
;         ]
;         if all [(evt/3 = 'menu)  (evt/4 = 'quit)] [quit]
    ]
    false
]

system/ports/system/awake: :system-awake
append system/ports/wait-list system/ports/system

view layout [
    style button button 200
    button "Add Tray Menus" [
        set-modes system/ports/system compose/deep [
            tray: [
                add main [

                    help: (rejoin ["REBOL/Link" any [""]]) ; tooltip

                    menu: [test: "Test" desktop: "Start Desktop" bar quit: "Quit"]
                ]
                add other [
                    ;help: (rejoin ["REBOL/Link" any [""]])
                    menu: [test-2: "Test-2" bar quit-2: "Quit-2"]
                ]
            ]
        ]
    ]
    button "Remove Tray Main Menu" [
        set-modes system/ports/system [
            tray: [remove main]
        ]
    ]
    button "Remove Tray Other Menu" [
        set-modes system/ports/system [
            tray: [remove other]
        ]
    ]
    ;button "Change Tray Other Menu" [
    ;    set-modes system/ports/system [
    ;        tray: [
    ;            change other [
    ;                help: "New Help!"

    ;                menu: [test-3: "Test-3" bar quit-3: "Quit-3"]
    ;            ]
    ;        ]
    ;    ]
    ;]
    button "Modify Tooltip" [
        nid: make struct! NOTIFYICONDATA none
        nid/hwnd: my-hwnd?
        nid/uid: 1
        nid/cbSize: length? third nid
        nid/uFlags:  NIF_TIP  ; NIF_ICON
        ;nid/hIcon:
        ;nid/szTip:  "New ToolTip!^@"
        set-tray-tooltip nid "New ToolTip A!"
        ;print mold third nid
        res: Shell_NotifyIcon NIM_MODIFY nid
        print [res to logic! res]
    ]
    button "Modify Other Tooltip" [
        nid: make struct! NOTIFYICONDATA none
        nid/hwnd: my-hwnd?
        nid/uid: 2
        nid/cbSize: length? third nid
        nid/uFlags:  NIF_TIP  ; NIF_ICON
        ;nid/hIcon:
        ;nid/szTip:  "New ToolTip!^@"
        set-tray-tooltip nid "New ToolTip B!"
        ;print mold third nid
        res: Shell_NotifyIcon NIM_MODIFY nid
        print [res to logic! res]
    ]
    button "Unview" [unview]
    status: text 200
]



free lib
Maxim:
12-May-2009
rebol []


view*: system/view
; code taken with [probe second get in system/view 'wake-event]
view*/wake-event: func [port ] bind [
    event: pick port 1
    if none? event [

        if debug [print "Event port awoke, but no event was present."]
        return false
    ]
    either pop-face [

        if in pop-face/feel 'pop-detect [event: pop-face/feel/pop-detect 
        pop-face event]
        do event
        found? all [
            pop-face <> pick pop-list length? pop-list
            (pop-face: pick pop-list length? pop-list true)
        ]
    ] [
        do event
        ; OUR HACK >>
        if event/type = 'resize [
        	event/face/feel/after-resize event/face event
        ]
        ; <<
        empty? screen-face/pane
    ]
] in view* 'self

window: view/new/options layout [bt: button "ok" ] [resize]

window/feel: make window/feel [
	after-resize: func [face event ][
		;probe event/type
		;probe "AFTER RESIZE"
		if event/type = 'resize [
			bt/offset/x: face/size/x / 2 - (bt/size/x / 2)
			show bt
		]
		event
	]
]
do-events
Maxim:
16-May-2009
basically at each operation, like clicking on a folder to view its 
content, I use call with an ssh related command.

I retrieve the output, report any errors or parse the return data 
and refresh the ui.


currently, it starts with root dir list, and you click on folders 
to go into them, or click on a checkbox to select it for other file 
manipulations.


each time I use call, the command-line must do a log-ing, since a 
system call is an atomic operation.
Henrik:
10-Jul-2009
A quick search on "rebol glayout" reveals the rebol.org version, 
the docs for REBOL's own LAYOUT and some mailing list posts about 
glayout.
Henrik:
3-Aug-2009
When reading through the View Reference, it's not clear what happens, 
when you return an integer from the iteration function. I can see 
the iteration function is run again with that value as input, but 
I can't tell where it's run. I had hoped to redraw single lines in 
a list with a simple mouse over, but I guess you need to do something 
unknown to provoke the redraw.
Using SHOW in the function causes an infinite loop.
james_nak:
3-Sep-2009
Does anyone know how to set the selected rows programatically within 
a text-list?
Geomol:
4-Sep-2009
>> main: layout [tl: text-list data ["line 1" "line 2" "line 3"]]
>> insert tl/picked "line 2"
>> view main
Pekr:
12-Sep-2009
new down-face is set when you click down

 - just curious. What if you would like to do multi-selection? I mean 
 - holding shift down, and selecting e.g. some list elements? You 
 have to remember all down faces, no?
2001 / 323312345...1920[21] 2223...2930313233