Newbie VIEW problem
[1/4] from: kpeters-vu:ware at: 22-Nov-2005 20:33
Hi all ~
when I press the New button from the script below, Rebol complains with
** Script Error: foreach expected data argument of type: series
** Where: clear-fields
** Near: foreach face panel/pane [
if all [series? face/text flag-face? face field] [
clear face/text
face/line-list: none
and I have no clue as to why?
Can someone enlighten me?
TIA,
Kai
... snip
;------------------------------------------------------------------------------------------------
entrypanel: layout [
across
label "First Name" field_FirstName: field 200 "Joe"
label "Last Name" field_LastName: field 200 return
]
;------------------------------------------------------------------------------------------------
form_ClientMaintenance: layout [
across
clientpanel: box entry-panel/size with [ pane:
entrypanel ] return
newbutton: button "New" [ rec-new ]
]
;------------------------------------------------------------------------------------------------
rec-new: func [][
clear-fields clientpanel
focus field_FirstName
]
...snip
[2/4] from: Izkata::Comcast::net at: 22-Nov-2005 22:52
It's the way you're using the "with: [pane: ....]" part -
clientpanel/pane contains a face, which is also
referenced to by entrypanel. entrypanel/pane is
what contains the fields to be cleared, so there's 3
fast ways to fix this:
clear-fields clientpanel/pane ;<-- these reference the same face
clear-fields entrypanel ;<-- these reference the same face
Or, the line in form_ClientMaintenance could be changed
to work the way you're thinking:
From:
clientpanel: box entry-panel/size with [ pane: entrypanel ]
To:
clientpanel: box entry-panel/size with [ pane: entrypanel/pane ]
(Hope this helps)
[3/4] from: kpeters-vu:ware at: 23-Nov-2005 14:40
Hi Izkata ~
thanks for trying to help - still doesn't work at all, though.
Here's what I get - anybody can make this very code work and explain
what's up?
TIA,
Kai
================================================================
panel1: layout[
across
f1: field 50 "field1" f2: field 50 "field2" f3: field 50 "field3"
]
mainform: layout [
below
entrypanel: box panel1/size with [pane: panel1/pane ]
clearbutton: button "Clear" [ clear-fields entrypanel ]
]
-------------------------------------------------------------------------------------------------
Button press result: Nothing visible
================================================================
panel1: layout[
across
f1: field 50 "field1" f2: field 50 "field2" f3: field 50 "field3"
]
mainform: layout [
below
entrypanel: box panel1/size with [pane: panel1 ]
clearbutton: button "Clear" [ clear-fields panel1/pane ]
]
-------------------------------------------------------------------------------------------------
Button press result:
** Script Error: clear-fields expected panel argument of type: object
** Where: func [face value][clear-fields panel1/pane]
** Near: clear-fields panel1/pane
================================================================
panel1: layout[
across
f1: field 50 "field1" f2: field 50 "field2" f3: field 50 "field3"
]
mainform: layout [
below
entrypanel: box panel1/size with [pane: panel1 ]
clearbutton: button "Clear" [ clear-fields entrypanel/pane ]
]
view mainform
-------------------------------------------------------------------------------------------------
Button press result: Nothing visible
================================================================
panel1: layout[
across
f1: field 50 "field1" f2: field 50 "field2" f3: field 50 "field3"
]
mainform: layout [
below
entrypanel: box panel1/size with [pane: panel1/pane ]
clearbutton: button "Clear" [ clear-fields entrypanel/pane ]
]
-------------------------------------------------------------------------------------------------
Button press result:
** Script Error: clear-fields expected panel argument of type: object
** Where: func [face value][clear-fields entrypanel/pane]
** Near: clear-fields entrypanel/pane
================================================================
panel1: layout[
across
f1: field 50 "field1" f2: field 50 "field2" f3: field 50 "field3"
]
mainform: layout [
below
entrypanel: box panel1/size with [pane: panel1/pane ]
clearbutton: button "Clear" [ clear-fields entrypanel ]
]
-------------------------------------------------------------------------------------------------
Button press result: Nothing visible
[4/4] from: antonr::lexicon::net at: 25-Nov-2005 16:53
You're right, CLEAR-FIELDS does not expect panel to have
its pane set to a face directly. It expects a block
of faces. So the work-around is to give it a block:
pane: reduce [entrypanel]
That is a clear deficiency of CLEAR-FIELDS and should be
fixed. I posted a ticket to RAMBO bug tracker.
Anton.