1. Bug getText

I have written a small test program with Judith Evans IDE v1.0.0 and
Win32lib v0.60.6
There is Combo2, Combo5 and EditText4.
When Combo2 is changed then EditText4 should get the text from Combo5.
Now if I print David in Combo5 and select Bert in Combo2, then EditText4
becomes blank (bug?).
If I write something in Combo2 then EditText4 get the text from Combo5 (ok!)

--------------------------------------------------------------------------------
addItem(Combo2,{"Adam","Bert","Charles"})
setIndex(Combo2,1)
addItem(Combo5,{"Dan","Evelyn","Philip"})
setIndex(Combo5,1)

--------------------------------------------------------------------------------
procedure Combo2_onChange (integer self, integer event, sequence params)--params
is ()
setText(EditText4,getText(Combo5))
end procedure
setHandler( Combo2, w32HChange, routine_id("Combo2_onChange"))

Dan-Åke Engqvist

new topic     » topic index » view message » categorize

2. Re: Bug getText

Dan-Åke Engqvist wrote:
> 
> I have written a small test program with Judith Evans IDE v1.0.0 and
> Win32lib v0.60.6
> There is Combo2, Combo5 and EditText4.
> When Combo2 is changed then EditText4 should get the text from Combo5.
> Now if I print David in Combo5 and select Bert in Combo2, then EditText4
> becomes blank (bug?).
> If I write something in Combo2 then EditText4 get the text from Combo5 (ok!)
> 
>
> --------------------------------------------------------------------------------
> addItem(Combo2,{"Adam","Bert","Charles"})
> setIndex(Combo2,1)
> addItem(Combo5,{"Dan","Evelyn","Philip"})
> setIndex(Combo5,1)
> 
>
> --------------------------------------------------------------------------------
> procedure Combo2_onChange (integer self, integer event, sequence
> params)--params
> is ()
> setText(EditText4,getText(Combo5))
> end procedure
> setHandler( Combo2, w32HChange, routine_id("Combo2_onChange"))
> 
> Dan-Åke Engqvist
Hi

This isn't a bug so much as a change of concept when using a Combo.  The Combo
is a combination of an EditText and a List.  So when you want to get the text
from the EditText you need to ask what its control id is.

ie (in your onChange)

     setText(EditText4,getText(getEdit(Combo5)))

getEdit() is described (in the documentation I have, also 0.60.6) in the
"Controls" section.  It isn't mentioned anywhere in the "List Control" section
though, so I can understand the confusion.

Gary

new topic     » goto parent     » topic index » view message » categorize

3. Re: Bug getText

gshingles wrote:
> 
> Dan-Åke Engqvist wrote:
> > 
> > I have written a small test program with Judith Evans IDE v1.0.0 and
> > Win32lib v0.60.6
> > There is Combo2, Combo5 and EditText4.
> > When Combo2 is changed then EditText4 should get the text from Combo5.
> > Now if I print David in Combo5 and select Bert in Combo2, then EditText4
> > becomes blank (bug?).
> > If I write something in Combo2 then EditText4 get the text from Combo5 (ok!)
> > 
> >
> > --------------------------------------------------------------------------------
> > addItem(Combo2,{"Adam","Bert","Charles"})
> > setIndex(Combo2,1)
> > addItem(Combo5,{"Dan","Evelyn","Philip"})
> > setIndex(Combo5,1)
> > 
> >
> > --------------------------------------------------------------------------------
> > procedure Combo2_onChange (integer self, integer event, sequence
> > params)--params
> > is ()
> > setText(EditText4,getText(Combo5))
> > end procedure
> > setHandler( Combo2, w32HChange, routine_id("Combo2_onChange"))
> > 
> > Dan-Åke Engqvist
> Hi
> 
> This isn't a bug so much as a change of concept when using a Combo.  The Combo
> is a combination of an EditText and a List.  So when you want to get the text
> from the EditText you need to ask what its control id is.
> 
> ie (in your onChange)
> 
>      setText(EditText4,getText(getEdit(Combo5)))
> 
> getEdit() is described (in the documentation I have, also 0.60.6) in the
> "Controls"
> section.  It isn't mentioned anywhere in the "List Control" section though,
> so I can understand the confusion.
> 
> Gary

Thanks a lot!!

I have tryed this now, but there is still a problem.

Here is a change of my testprogram (there is only EditText4 and Combo5):

--------------------------------------------------------------------------------
addItem(Combo5,{"Dan","Evelyn","Philip"})
setIndex(Combo5,1)

--------------------------------------------------------------------------------
procedure Combo5_onChange (integer self, integer event, sequence params)--params
is ()
--setText(EditText4,getText(Combo5))
setText(EditText4,getText(getEdit(Combo5)))
end procedure
setHandler( Combo5, w32HChange, routine_id("Combo5_onChange"))


The problem is that when I select an item in Combo5 then it
writes the old item to EditText4.
If I write something in Combo5 then it shows up in EditText4 directly.
If I use 'setText(EditText4,getText(Combo5))' then it works as
expected.
Dan-Åke

new topic     » goto parent     » topic index » view message » categorize

4. Re: Bug getText

Dan-Åke Engqvist wrote:
> 
> > getEdit() is described (in the documentation I have, also 0.60.6) in the
> > "Controls"
> > section.  It isn't mentioned anywhere in the "List Control" section though,
> > so I can understand the confusion.
> > 
> > Gary
> 
> Thanks a lot!!
> 
> I have tryed this now, but there is still a problem.
> 
> Here is a change of my testprogram (there is only EditText4 and Combo5):
> 
>
> --------------------------------------------------------------------------------
> addItem(Combo5,{"Dan","Evelyn","Philip"})
> setIndex(Combo5,1)
> 
> The problem is that when I select an item in Combo5 then it
> writes the old item to EditText4.
> If I write something in Combo5 then it shows up in EditText4 directly.
> If I use 'setText(EditText4,getText(Combo5))' then it works as
> expected.
> Dan-Åke

Yes, that is puzzling.  I notice params returns either 4 or 2 depending on
whether the Combo was changed, or whether the EditText is changing.

I don't know where they come from or if they are system dependent (anyone else
able to comment on that? It seems to be undocumented).

So this works for me in the onChange:

procedure Combo5_onChange (integer self, integer event, sequence params)--params
is () -- no it's not
    if params[1] = 4 then -- combo change
    	setText(EditText4,getText(Combo5))
    else -- assume params[1] = 2
        setText(EditText4,getText(getEdit(Combo5)))
    end if
end procedure
setHandler( Combo5, w32HChange, routine_id("Combo5_onChange"))


From what I can tell, params[2] is the index of the selected item, or 0 if it
 is the EditText, except for the first call (which could be where the bug comes
 in?)

Gary

new topic     » goto parent     » topic index » view message » categorize

5. Re: Bug getText

gshingles wrote:
> 
> Dan-Åke Engqvist wrote:
> > 
> > > getEdit() is described (in the documentation I have, also 0.60.6) in the
> > > "Controls"
> > > section.  It isn't mentioned anywhere in the "List Control" section
> > > though,
> > > so I can understand the confusion.
> > > 
> > > Gary
> > 
> > Thanks a lot!!
> > 
> > I have tryed this now, but there is still a problem.
> > 
> > Here is a change of my testprogram (there is only EditText4 and Combo5):
> > 
> >
> > --------------------------------------------------------------------------------
> > addItem(Combo5,{"Dan","Evelyn","Philip"})
> > setIndex(Combo5,1)
> > 
> > The problem is that when I select an item in Combo5 then it
> > writes the old item to EditText4.
> > If I write something in Combo5 then it shows up in EditText4 directly.
> > If I use 'setText(EditText4,getText(Combo5))' then it works as
> > expected.
> > Dan-Åke
> 
> Yes, that is puzzling.  I notice params returns either 4 or 2 depending on
> whether
> the Combo was changed, or whether the EditText is changing.
> 
> I don't know where they come from or if they are system dependent (anyone else
> able to comment on that? It seems to be undocumented).
> 
> So this works for me in the onChange:
> 
> }}}
<eucode>
> procedure Combo5_onChange (integer self, integer event, sequence
> params)--params
> is () -- no it's not
>     if params[1] = 4 then -- combo change
>     	setText(EditText4,getText(Combo5))
>     else -- assume params[1] = 2
>         setText(EditText4,getText(getEdit(Combo5)))
>     end if
> end procedure
> setHandler( Combo5, w32HChange, routine_id("Combo5_onChange"))
> </eucode>
{{{

> 
>  From what I can tell, params[2] is the index of the selected item, or 0 if
> it is the EditText, except for the first call (which could be where the bug
> comes in?)
> 
> Gary

This is documented in the w32HChange event doc.
params[1] is either:
* w32CHG_Sel, which is 4, when the selection in a list or combo changes;
* w32CHG_Chg, which is 2, when the contents of an edit field, either standalone
or in a combo, change.
params[2] is the 1 based new index, or 0 for an edit box.

Further, getText() takes special care to return the selected text when the
reflection of the change in the combo edit box is pending, rather than the
obsolete value.

So I'd say it's a feature, rather.

CChris

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu