1. Win - Combo control behavior

I have a combo box (into which, thanks to whatever mysterious fix in version
0.50, I can now enter text). I wrote an onChange event handler for this
Combo, which detects each and every character I type into the box. Just what
I wanted.

HOWEVER, when I select from the list, and in my onChange event handler I
call getText() to determine the newly selected value of the control,
getText() is returning the PREVIOUS (text) value of the control - whether
typed-in text or a selection from the list. This is USELESS for my purposes,
and patently erroneous.

TESTED code you can cut&paste to observe this behavior:

<code>
include \euphoria\userlib\win32lib.50\win32lib.ew -- change to your path

constant
  win = create(Window, "", 0, Default, Default, 200, 200, 0),
  combo = create(Combo, "", win, 10, 10, 120, 80, 0),
  status = create(StatusBar, "", win, 0, 0, 0, 0, 0)

procedure onChange_combo()
  setText(status, getText(combo))
end procedure

addItem(combo, "micro")
addItem(combo, "snort")
addItem(combo, "is")
addItem(combo, "evil")

onChange[combo] = routine_id("onChange_combo")

WinMain(win, Normal)
</code>

Will one of you "Windows gurus" tell me how to fix this, please?

Thanks,
George
_____________________________________________________________________________________
Get more from the Web.  FREE MSN Explorer download : http://explorer.msn.com

new topic     » topic index » view message » categorize

2. Re: Win - Combo control behavior

Here's the answer to your Question

**Begin Code**

include win32lib.ew

constant
  win = create(Window, "", 0, Default, Default, 200, 200, 0),
  combo = create(Combo, "", win, 10, 10, 120, 80, 0),
  status = create(StatusBar, "", win, 0, 0, 0, 0, 0)

sequence combo_txt
integer index

combo_txt = {"micro","snort","is","evil"}

procedure onChange_combo()
  index = getIndex(combo)
  setText(status, combo_txt[index])
end procedure

for add_txt = 1 to length(combo_txt) do
    addItem(combo, combo_txt[add_txt])
end for

onChange[combo] = routine_id("onChange_combo")

WinMain(win, Normal)

**End Code**

euman at bellsouth.net

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

3. Re: Win - Combo control behavior

Please disregard, This method works only when
not entering data into the combo....

It does work for selecting the list from the dropdown
of the combo...

euman

----- Original Message -----
From: "Euman" <euman at BELLSOUTH.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, December 04, 2000 1:46 AM
Subject: Re: Win - Combo control behavior


> Here's the answer to your Question
>
> **Begin Code**
>
> include win32lib.ew
>
> constant
>   win = create(Window, "", 0, Default, Default, 200, 200, 0),
>   combo = create(Combo, "", win, 10, 10, 120, 80, 0),
>   status = create(StatusBar, "", win, 0, 0, 0, 0, 0)
>
> sequence combo_txt
> integer index
>
> combo_txt = {"micro","snort","is","evil"}
>
> procedure onChange_combo()
>   index = getIndex(combo)
>   setText(status, combo_txt[index])
> end procedure
>
> for add_txt = 1 to length(combo_txt) do
>     addItem(combo, combo_txt[add_txt])
> end for
>
> onChange[combo] = routine_id("onChange_combo")
>
> WinMain(win, Normal)
>
> **End Code**
>
> euman at bellsouth.net
>

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

Search



Quick Links

User menu

Not signed in.

Misc Menu