Building a GUI Forms Designer
[1/2] from: james::mustard::co::nz at: 28-Oct-2001 2:49
Hi there, currently I am in the process of building a GUI Forms Designer
and all is progressing nicely with the exception of a few objects that
either don't create properly with make-face, or once created refuse to
respond to feel/engage events. Below is a portion of the code which
activates depending on the object the user wishes to create:
make-this: func ['obj] [
append work-form/pane v: make-face obj
v/offset: 200x200 ;current generic spawn point
if none? v/color [v/color: white]
v/feel: make v/feel [
engage: func [face action event][
if action = 'down [
start: event/offset
remove find face/parent-face/pane face
append face/parent-face/pane face
]
if find [over away] action [
face/offset: face/offset + event/offset - start
show face
]]]
show v
show work-form
]
Calling format is: make-this <object type>
This creates an object with origin 200x200 in the current work-form (a
subface of the main window pane) and enables drag and z-order events for the
object.
Objects that create properly and are fully interactive: Field, Area, Button,
Image, Choice, Toggle, Check, Radio, Box, Progress, Slider, Arrow, LED
Creates, but no engage events: Text-List.
Doesn't create with make-face: Label, Text, Anim, Icon, List, Rotary, List,
Panel
Not tested: all other objects.
Any suggections for working with the text-list events and suggestions on
more detailed help on make-face would be appreciated :)
[2/2] from: rotenca:telvia:it at: 28-Oct-2001 20:42
Text-lists are a little hard to control.
When you click on a field, it is used this function in the text-list (t):
t/iter/feel/engage:
func[f a e][
if a = 'down [
if cnt > length? head lines [exit]
if not e/control [f/state: cnt clear picked]
alter picked f/text
do :act slf f/text
]
if a = 'up [f/state: none]
show pane
]
where f should be the face of the single iterated row
slf is the text-list face and act is a copy of the action created by VID.
slf and act are fields of the text-list face.
The textlist face has a panel in its pane and in the panel there is the slider
and a box (t/sub-area) whose pane is a function (t/text-pane) which
dinamically creates the face of the rows (t/iter)
I think you should try:
t: make-face 'text-list
t/act: func[face value][print "called"]
---
Ciao
Romano