[ALLY] Re: HELP needed about the dropdown list widget
[1/10] from: larry::ecotope::com at: 11-Apr-2001 16:04
Hi Allen
Drop-down works ok under View 1.0 here. After uncommenting the demo I had to
remove the none after the first block arg for view/title as it wanted a
string. The demo then worked ok.
Cheers
-Larry
[2/10] from: etienne:alaurent:free at: 11-Apr-2001 19:24
I found a script in www.rebolforce.com with a new widget : the dropdown widget.
The code of this widget is :
dropdowns: stylize [
dropdown: text
black white 100 edge [color: 110.120.130 size: 2x2 effect: 'ibevel]
font [shadow: none]
middle
with [
list-lay: none
show-arrow?: true
rows: 4
size: 100x24
line-list: action: none
list-data: copy []
dd-feel: make face/feel [
over: redraw: detect: none
engage: func [face action event][
switch action [
time [if not face/state [face/blinker: not face/blinker]]
down [face/state: on]
alt-down [face/state: on]
up [if face/state [face/show-dropdown] face/state: off]
alt-up [if face/state [do-face-alt face none] face/state: off]
over [face/state: on]
away [face/state: off]
]
show face
]
]
arrow-button: does [
layout [
origin 0x0 arrow down [self/show-dropdown]
edge [color: 110.120.130 size: 2x2 effect: 'ibevel] 128.128.128 14x20
]
]
show-dropdown: func [/local tl picked][
if not list-lay [
list-lay: layout [
origin 0x0 at 0x0
tl: text-list data self/list-data bold to-pair reduce [size/x rows * 15 + 4]
self/font/color self/color
[ self/data: self/text: value show list-lay
wait 0:0:0.03 ; long enough to see selection
hide-popup show self
]
do [if picked: find self/list-data self/text [append clear tl/picked first picked]]
]
list-lay/offset: to-pair reduce [self/offset/x self/offset/y + self/size/y]
]
show-popup/window list-lay self/parent-face
do-my-events/away list-lay
do-face self self/data
]
reset: does [list-lay: none]
resize: does [
reset ; so list-pane will redraw at correct size
{Reset if a change has been made to the data}
size/x: max 32 size/x
size/y: max 24 size/y
either show-arrow? [
pane: arrow-button
pane/offset: 0x0 pane/offset/x: self/size/x - arrow-button/size/x - 4
arrow-button/size/y: self/size/y
][pane: none]
show self
]
pane: none
words: [data [new/list-data: second args next args]
rows [new/rows: second args next args]]
init: append copy init [
arrow-button: arrow-button
resize
self/feel: self/dd-feel
]
]
]
It appears that this widget doesn't operate in the new version of Rebol/view
like it did with the previous version because the do-events function is not
the same.
In the previous version of Rebol/View, the do-events function was :
do-events: func [
"Process all View events."
/only "Restrict events to only a single window face" face
/away "Same as only, but event outside cancels" wf
/ports port-block [block!] "Port/action dispatch list"
/local flag event no-btn
][
if away [only: true face: wf]
wf: either all [only face/parent-face] [face/parent-face/pane] [system/view/screen-face/pane]
if not flag: event-port [event-port: open [scheme: 'event]]
ports: reduce [event-port]
either port-block [
foreach [port job] port-block: reduce port-block [
if any [number? port time? port] [if none? timeblk [timeblk: :job]]
append ports port
]
] [port-block: copy []]
insert/only port-block either only [
if block? get in face 'pane [
no-btn: foreach item face/pane [if get in item 'action [break/return false] true]
]
[
event: first event-port
either any [
event/face = face
within? event/offset win-offset? face face/size
] [
if any [all [event/type = 'up no-btn] event/type = 'close] [hide-popup break]
do event
] [
if away [
if not find [move time] event/type [hide-popup]
do event
]
]
]
] [[do first event-port]]
insert/only port-block event-port
while either only [[find wf face]] [[not empty? wf]] [
either awake: wait/all ports [
foreach item awake [
set/any 'result do select port-block item item
if all [value? 'result 'break = :result] [break]
]
if all [value? 'result 'break = :result] [break]
] [do :timeblk]
]
if not flag [close event-port event-port: none]
]
And now the do-events function source is :
do-events: func [
"Process all View events."
][
wait []
]
Can anyone expain me how to do now ?
Thank you
[3/10] from: etienne:alaurent:free at: 12-Apr-2001 0:17
Hi,
I found a script in www.rebolforce.com with a new widget : the dropdown widget.
The code of this widget is :
dropdowns: stylize [
dropdown: text
black white 100 edge [color: 110.120.130 size: 2x2 effect: 'ibevel]
font [shadow: none]
middle
with [
list-lay: none
show-arrow?: true
rows: 4
size: 100x24
line-list: action: none
list-data: copy []
dd-feel: make face/feel [
over: redraw: detect: none
engage: func [face action event][
switch action [
time [if not face/state [face/blinker: not face/blinker]]
down [face/state: on]
alt-down [face/state: on]
up [if face/state [face/show-dropdown] face/state: off]
alt-up [if face/state [do-face-alt face none] face/state: off]
over [face/state: on]
away [face/state: off]
]
show face
]
]
arrow-button: does [
layout [
origin 0x0 arrow down [self/show-dropdown]
edge [color: 110.120.130 size: 2x2 effect: 'ibevel] 128.128.128 14x20
]
]
show-dropdown: func [/local tl picked][
if not list-lay [
list-lay: layout [
origin 0x0 at 0x0
tl: text-list data self/list-data bold to-pair reduce [size/x rows * 15 + 4]
self/font/color self/color
[ self/data: self/text: value show list-lay
wait 0:0:0.03 ; long enough to see selection
hide-popup show self
]
do [if picked: find self/list-data self/text [append clear tl/picked first picked]]
]
list-lay/offset: to-pair reduce [self/offset/x self/offset/y + self/size/y]
]
show-popup/window list-lay self/parent-face
;do-my-events/away list-lay
do-face self self/data
]
reset: does [list-lay: none]
resize: does [
reset ; so list-pane will redraw at correct size
{Reset if a change has been made to the data}
size/x: max 32 size/x
size/y: max 24 size/y
either show-arrow? [
pane: arrow-button
pane/offset: 0x0 pane/offset/x: self/size/x - arrow-button/size/x - 4
arrow-button/size/y: self/size/y
][pane: none]
show self
]
pane: none
words: [data [new/list-data: second args next args]
rows [new/rows: second args next args]]
init: append copy init [
arrow-button: arrow-button
resize
self/feel: self/dd-feel
]
]
]
It appears that this widget doesn't operate in the new version of Rebol/view
like it did with the previous version because the do-events function is not
the same.
In the previous version of Rebol/View, the do-events function was :
do-events: func [
"Process all View events."
/only "Restrict events to only a single window face" face
/away "Same as only, but event outside cancels" wf
/ports port-block [block!] "Port/action dispatch list"
/local flag event no-btn
][
if away [only: true face: wf]
wf: either all [only face/parent-face] [face/parent-face/pane] [system/view/screen-face/pane]
if not flag: event-port [event-port: open [scheme: 'event]]
ports: reduce [event-port]
either port-block [
foreach [port job] port-block: reduce port-block [
if any [number? port time? port] [if none? timeblk [timeblk: :job]]
append ports port
]
] [port-block: copy []]
insert/only port-block either only [
if block? get in face 'pane [
no-btn: foreach item face/pane [if get in item 'action [break/return false] true]
]
[
event: first event-port
either any [
event/face = face
within? event/offset win-offset? face face/size
] [
if any [all [event/type = 'up no-btn] event/type = 'close] [hide-popup break]
do event
] [
if away [
if not find [move time] event/type [hide-popup]
do event
]
]
]
] [[do first event-port]]
insert/only port-block event-port
while either only [[find wf face]] [[not empty? wf]] [
either awake: wait/all ports [
foreach item awake [
set/any 'result do select port-block item item
if all [value? 'result 'break = :result] [break]
]
if all [value? 'result 'break = :result] [break]
] [do :timeblk]
]
if not flag [close event-port event-port: none]
]
And now the do-events function source is :
do-events: func [
"Process all View events."
][
wait []
]
Can anyone expain me how to do now ?
Thank you
[4/10] from: etienne::alaurent::free::fr at: 12-Apr-2001 0:40
[ALLY] HELP about the dropdown list widget
I made a mistake when I copied the new style for the dropdown list widget :
the code of this widget is :
dropdowns: stylize [
dropdown: text
black white 100 edge [color: 110.120.130 size: 2x2 effect: 'ibevel]
font [shadow: none]
middle
with [
list-lay: none
show-arrow?: true
rows: 4
size: 100x24
line-list: action: none
list-data: copy []
dd-feel: make face/feel [
over: redraw: detect: none
engage: func [face action event][
switch action [
time [if not face/state [face/blinker: not face/blinker]]
down [face/state: on]
alt-down [face/state: on]
up [if face/state [face/show-dropdown] face/state: off]
alt-up [if face/state [do-face-alt face none] face/state: off]
over [face/state: on]
away [face/state: off]
]
show face
]
]
arrow-button: does [
layout [
origin 0x0 arrow down [self/show-dropdown]
edge [color: 110.120.130 size: 2x2 effect: 'ibevel] 128.128.128 14x20
]
]
show-dropdown: func [/local tl picked][
if not list-lay [
list-lay: layout [
origin 0x0 at 0x0
tl: text-list data self/list-data bold to-pair reduce [size/x rows * 15 + 4]
self/font/color self/color
[ self/data: self/text: value show list-lay
wait 0:0:0.03 ; long enough to see selection
hide-popup show self
]
do [if picked: find self/list-data self/text [append clear tl/picked first picked]]
]
list-lay/offset: to-pair reduce [self/offset/x self/offset/y + self/size/y]
]
show-popup/window list-lay self/parent-face
do-events/away list-lay
do-face self self/data
]
reset: does [list-lay: none]
resize: does [
reset ; so list-pane will redraw at correct size
{Reset if a change has been made to the data}
size/x: max 32 size/x
size/y: max 24 size/y
either show-arrow? [
pane: arrow-button
pane/offset: 0x0 pane/offset/x: self/size/x - arrow-button/size/x - 4
arrow-button/size/y: self/size/y
][pane: none]
show self
]
pane: none
words: [data [new/list-data: second args next args]
rows [new/rows: second args next args]]
init: append copy init [
arrow-button: arrow-button
resize
self/feel: self/dd-feel
]
]
]
The difference is in the show-dropdown func. It wasn't
;do-my-events/away list-lay
but
do-events/away list-lay
It is this instruction witch can't be executed with the new Rebol/View version.
And I am not enough frendly with the face feeling event association to make the
changes.
Thank you for any answer.
[5/10] from: allenk:powerup:au at: 12-Apr-2001 20:43
Re: HELP needed about the dropdown list widget
Hi Etienne,
I am the author of that dropdown style, I do have a version that works in
Link, but I haven't had a chance to see if it also works in the latest View,
though it should do so.
Please let me know.
http://www.rebolforces.com/reb/drop-down.rss
Cheers,
Allen K
[6/10] from: etienne:alaurent:free at: 12-Apr-2001 1:20
Le jeu, 12 avr 2001, vous avez écrit :
>Hi Etienne,
>I am the author of that dropdown style, I do have a version that works in
<<quoted lines omitted: 8>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
Hi Allen,
I tested the new dropdown list widget.
It seems to work well with your script example, but It doesn't work in my (very
long) script :
-First the actions associated to the widget are not ALWAYS executed;
-Secondly sometime I can't have access to others widgets (buttons, text-lists,
fields, ...);
-Third after few tests I obtain a core dumped.
I am working with the new linux version of Rebol/View, and I am using the win95
skins from DocKimbel and particularly the frame widget, the tabpanel widget,
the label widget, and the check widget (I disabled his rewrited layout function)
Is there bugs in Rebol/View ? or incompatibilities in the win95 skins ?
cheers,
Etienne
[7/10] from: etienne:alaurent:free at: 12-Apr-2001 2:31
Hi Allen,
After many tests about the new dropdown list widget, I obtained this error
message :
** Script Error: Not enough memory
** Where: do-events
** Near: wait []
So, I think the problem is not in the win95 skins code, nor in your code, but
in the do-events function or in the Rebol/View program.
What do you think about this ?
Cheers,
Etienne
[8/10] from: etienne:alaurent:free at: 12-Apr-2001 2:30
Le jeu, 12 avr 2001, vous avez écrit :
>Hi Etienne,
>I am the author of that dropdown style, I do have a version that works in
<<quoted lines omitted: 8>>
>[rebol-request--rebol--com] with "unsubscribe" in the
>subject, without the quotes.
Hi Allen,
I tested the new dropdown list widget.
It seems to work well with your script example, but It doesn't work in my (very
long) script :
-First the actions associated to the widget are not ALWAYS executed;
-Secondly sometime I can't have access to others widgets (buttons, text-lists,
fields, ...);
-Third after few tests I obtain a core dumped.
I am working with the new linux version of Rebol/View, and I am using the win95
skins from DocKimbel and particularly the frame widget, the tabpanel widget,
the label widget, and the check widget (I disabled his rewrited layout function)
Is there bugs in Rebol/View ? or incompatibilities in the win95 skins ?
cheers,
Etienne
[9/10] from: etienne:alaurent:free at: 12-Apr-2001 2:22
Hi Allen,
After many tests about the new dropdown list widget, I obtained this error
message :
** Script Error: Not enough memory
** Where: do-events
** Near: wait []
So, I think the problem is not in the win95 skins code, nor in your code, but
in the do-events function or in the Rebol/View program.
What do you think about this ?
Cheers,
Etienne
[10/10] from: allenk:powerup:au at: 12-Apr-2001 20:45
See my reply in the other list.
Cheers,
Allen K
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted