View and objects?
[1/3] from: g_pizzetta::bluewin::ch at: 3-Oct-2002 23:44
I have a probleme with view.
if i make an object including a layout:
Essai: make object! [ lay: layout [ text: field "" ]]
Essai1: make Essai
when i use
view/new Essai/lay
and
view/new Essai1/lay
view/new does not display a new windows, and if i try to find a way to do so, the values
of the two text field are the same even if they are not part of the saée object. How
can I go around this problem??
Thank's a lot. Gilles
[2/3] from: rotenca:telvia:it at: 4-Oct-2002 1:13
Hi,
> I have a probleme with view.
> if i make an object including a layout:
> Essai: make object! [ lay: layout [ text: field "" ]]
> Essai1: make Essai
> view/new does not display a new windows, and if i try to find a way to do
so, the values of the two text field are the >same even if they are not part
of the saée object. How can I go around this problem??
You must think to essai/lay like a pointer to an object.
Make Essai duplicates the pointer, not the object referenced by the pointer.
If you duplicate also the object referenced with something like:
make essay [lay: make lay]
The same problem arises for the object referenced by lay, which surely, being
a vid face, has pointers to others objects and so on.
A program could find all the references to objects in lay and duplicate them,
but it is not a simple solution.
For layout objects a more simple solution could be keeping the layout as a
block and recalculate it every time:
essai: context [layb: [button] lay: layout layb]
essai2: make essai [lay: layout layb]
---
Ciao
Romano
[3/3] from: carl:cybercraft at: 5-Oct-2002 10:05
Hi Gilles,
On 04-Oct-02, g wrote:
> I have a probleme with view.
> if i make an object including a layout:
> Essai: make object! [ lay: layout [ text: field "" ]]
Using 'text as a word for the field there isn't a good idea as layouts
already use text.
> Essai1: make Essai
That should be...
Essai1: make Essai []
> when i use
> view/new Essai/lay
<<quoted lines omitted: 3>>
> to do so, the values of the two text field are the same even if they
> are not part of the sa=E9e object. How can I go around this problem??
Use copy on the string in the layout. However, as you've found out,
making a copy of Essai like that doesn't make a copy of the layout
within the object. The following might be a suitable way around this
for you, depending on what you're trying to do...
lo: [ txt: field copy "" ]
Essai: make object! [ lay: layout lo]
Essai1: make Essai [ lay: layout lo]
view layout [
button "Essai" [view/new Essai/lay]
button "Essai 1" [view/new Essai1/lay]
]
HTH.
--
Carl Read
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted