Object question
[1/7] from: kpeters::otaksoft::com at: 17-Sep-2007 11:03
Hi all ~
I need to have 6 identical (visually) checkbox groups in one of
my layouts and thought I could do this:
cat-pane: layout/offset [
styles address-styles
;
at 10x10 lab "Undefined" at 100x10 sf-check1: check
at 10x30 lab "Undefined" at 100x30 sf-check2: check
at 10x50 lab "Undefined" at 100x50 sf-check3: check
..snip..
] 0x0
cat-pane2: make cat-pane
cat-pane3: make cat-pane []
cat-pane4: make cat-pane []
cat-pane5: make cat-pane []
cat-pane6: make cat-pane []
address-form: center-face layout [
..snip..
at 10x410=09box1: box cat-pane/size
at 150x420=09box2: box cat-pane/size
..snip..
]
box1/pane: cat-pane/pane
box2/pane: cat-pane2/pane
This results in:
** Script Error: Face object reused (in more than one pane): Undefined
** Where: view
** Near: show scr-face
if new [do-events]
>>
I don't think it's correct that it bemoans the caption of a label as
offending culprit here.
But more importantly, how can I achieve something like this?
TIA,
Kai
[2/7] from: anton::wilddsl::net::au at: 19-Sep-2007 23:26
Maybe something like this:
spec: [across lab "1" check lab "2" check lab "3" check]
view layout [panel spec panel spec]
Anton.
[3/7] from: kpeters::otaksoft::com at: 19-Sep-2007 16:09
Thanks a lot, Anton ~
very elegant & concise. I am not sure if it is possible ( and how) to set and get
values from a given checkbox, say the third checkbox from the top of sp2 ?
Kai
spec: [across lab "1" check lab "2" check lab "3" check] view layout [ sp1: panel spec
sp2: panel
spec]
On Wed, 19 Sep 2007 23:26:45 +1000, Anton Rolls wrote:
[4/7] from: anton::wilddsl::net::au at: 20-Sep-2007 12:56
Kai,
You need to inspect the face which is returned by LAYOUT.
Here is how you proceed, given the following layout:
window: layout [panel [check check] panel [check check]]
>> type? window
== object!
>> window/type
== face
>> type? window/pane
== block!
>> length? window/pane
== 2
>> type? window/pane/1
== object!
>> window/pane/1/type
== face
>> window/pane/1/style
== panel
>> type? window/pane/1/pane
== block!
>> length? window/pane/1/pane
== 2
>> type? window/pane/1/pane/1
== object!
>> window/pane/1/pane/1/type
== face
>> window/pane/1/pane/1/style
== check
etc.
You can get and set the value of the first check like this:
get-face window/pane/1/pane/1
set-face window/pane/1/pane/1 true
The above refers to each face indirectly (relative to
its parent face(s)). Depending on what you want to do,
it might be better to set some words to point at the
checks or panels directly.
What are you trying to do with 6 groups of checkboxes?
Anton.
[5/7] from: kpeters:otaksoft at: 19-Sep-2007 20:11
Thanks again, Anton ~
here's what my application does with these groups of checkboxes:
Each checkbox group is linked to a set field in a MySQL table of addresses
and holds a group of logical attributes for a particular address.
The corresponding label captions are read from a layout table and thus the
logicals receive their end-user "meaning". So, it might look like this
Address is a Address receives
---------------------------------------------
Golfer [ ] Newsletter [x]
Donor [x] Birthday card [x]
Client [ ] AGM invite [x]
Retired [ ] Open House invite [ ]
and so on.
Kai
On Thu, 20 Sep 2007 12:56:05 +1000, Anton Rolls wrote:
[6/7] from: anton::wilddsl::net::au at: 21-Sep-2007 1:30
Hi Kai,
This kind of sounds like what you're talking about:
data: reduce [
"Golfer" false
"Donor" true
"Client" false
"Retired" false
]
set-checkgroup: func [checkgroup data /local val][
foreach [label check] checkgroup/pane [
set reduce [in label 'text in check 'data] data
show check
data: skip data 2
]
show checkgroup
]
window: layout [
across
left-panel: panel [
across
style label label 150
label check return
label check return
label check return
label check return
]
right-panel: panel 150x150 [
across
style label label 150
label check return
label check return
]
button "set" [set-checkgroup left-panel data]
]
view window
Regards,
Anton.
[7/7] from: kpeters::otaksoft::com at: 20-Sep-2007 11:10
Hi Anton ~
close - because the label captions are read during app. startup and remain
static until script is rerun whereas the data changes on a per record basis
as the user navigates the address data set -
but your function is nevertheless very valuable for showing a few concepts
I require.
Thanks a lot,
Kai
On Fri, 21 Sep 2007 01:30:15 +1000, Anton Rolls wrote: