1. List Change Event

Derek,

Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?

The code below demonstrates the problem I'm having. I'm trying to keep
a list box showing the last item added, but...

--  code generated by Win32Lib IDE v0.18.20
 
include Win32lib.ew
without warning

--------------------------------------------------------------------------------
--  Window Window1
constant Window1 = createEx( Window, "Window1", 0, Default, Default, 167, 195,
0, 0 )
constant List2 = createEx( List, "List2", Window1, 4, 4, 148, 120, 0, 0 )
constant bttn_AddItem = createEx( PushButton, "Add Item", Window1, 36, 132, 88,
28, 0, 0 )
---------------------------------------------------------
--------------------------------------------------------------------------------
procedure List2_onChange (integer self, integer event, sequence params)--params
is ()
	setIndex(List2,getCount(List2))
	setFocus(bttn_AddItem)
end procedure
setHandler( List2, w32HChange, routine_id("List2_onChange"))
--------------------------------------------------------------------------------
procedure bttn_AddItem_onClick (integer self, integer event, sequence
params)--params is ()
	addItem(List2,sprintf("%d - This should be visible on list",getCount(List2)+1))
end procedure
setHandler( bttn_AddItem, w32HClick, routine_id("bttn_AddItem_onClick"))

WinMain( Window1,Normal )


-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

new topic     » topic index » view message » categorize

2. Re: List Change Event

Derek,

Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?

(See original post for code example.) :)

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

3. Re: List Change Event

cklester wrote:
> 
> Derek,
> 
> Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?
> 
> (See original post for code example.) :)
> 
> -=ck
> "Programming in a state of EUPHORIA."
> <a
> href="http://www.cklester.com/euphoria/">http://www.cklester.com/euphoria/</a>
> 
-- 
Derek Parnell
Melbourne, Australia

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

4. Re: List Change Event

cklester wrote:
> 
> Derek,
> 
> Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?

I'm working on it right now.

An event should be triggered and I assumed that Windows did, but it doesn't
so I'm going to add it in myself. For ComboBox lists, Windows already 
triggers this event but not for ListBoxes.

-- 
Derek Parnell
Melbourne, Australia

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

5. Re: List Change Event

Derek Parnell wrote:
> cklester wrote:
> > Derek,
> > Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?
> 
> An event should be triggered and I assumed that Windows did, but it doesn't
> so I'm going to add it in myself. For ComboBox lists, Windows already 
> triggers this event but not for ListBoxes.

Does Microsoft explain this behavior? It doesn't seem right.

THANK YOU!!!

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

6. Re: List Change Event

cklester wrote:
> 
> Derek Parnell wrote:
> > cklester wrote:
> > > Derek,
> > > Shouldn't addItem(aList,anItem) trigger a w32HChange event for a List?
> > 
> > An event should be triggered and I assumed that Windows did, but it doesn't
> > so I'm going to add it in myself. For ComboBox lists, Windows already 
> > triggers this event but not for ListBoxes.
> 
> Does Microsoft explain this behavior? It doesn't seem right.

As if... !!!

Anyhow, the change I've added to win32lib now might break some
existing code. This is because the w32HChange handler will be
invoked when a list item is added or deleted, or when the 
selection is changed to another item. The 'params' parameter
passed to the handler can be used to distinguish the reason
for being called. This also effects combo boxes the same way
, plus the handler is called whenever the edit box area is
modified.

The current behaviour is that the handler is invoked only
when the selection is changed.

-- 
Derek Parnell
Melbourne, Australia

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

7. Re: List Change Event

Derek Parnell wrote:
> 
> Anyhow, the change I've added to win32lib now might break some
> existing code.

Are you going to make that available as a patch?

-=ck
"Programming in a state of EUPHORIA."
http://www.cklester.com/euphoria/

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

8. Re: List Change Event

cklester wrote:
> 
> Derek Parnell wrote:
> > 
> > Anyhow, the change I've added to win32lib now might break some
> > existing code.
> 
> Are you going to make that available as a patch?

Its a bit awkward as small bits of code had to be added and modified
in lots of places.

The next release will be out in 24-36 hours. I'm adding some support
for MDI apps and that's not quite finished.

-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu