<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Le 7/01/2015 07:49, Marc Santhoff a
écrit :<br>
</div>
<blockquote cite="mid:1420613366.26747.6.camel@puma.das.netz"
type="cite">
<pre wrap="">Hi,
it has been a very long time since I've programmed GUIs. I have
forgotten how to fill a ListBox without having the event handler
OnSelectionChange executed.</pre>
</blockquote>
I've had the same problem for years, until I "invented" my method:<br>
- fill in the two events OnEnter and OnExit for the control<br>
- generate the code for the OnSelectionChange event and drop
immediately the event in the component explorer<br>
- manually fill in the following code in the three envents:<br>
<br>
TMyForm.MyComponentEnter(Sender: TObject);<br>
begin<br>
MyComponent.OnSelectionChange := MyComponentSelectionChange;<br>
// do the same for all other events you want to drive<br>
end<br>
<br>
TMyForm.MyComponentSlectionChange(Sender: TObject; ...);<br>
begin<br>
// do whatver to do when the event fires<br>
end<br>
<br>
TMyForm.MyComponentExit(Sender: TObject);<br>
begin<br>
MyComponent.OnSelectionChange := nil<br>
end<br>
<br>
Of course you can control any firing event using the OnEnter and
OnExit events of the control. This allows the program to fire events
only when the user enters the control.<br>
I think that GUI's lack a control property wich indicates whether
the events should always fire or fire only when the user enters the
control.<br>
<br>
Antonio.<br>
<blockquote cite="mid:1420613366.26747.6.camel@puma.das.netz"
type="cite">
<pre wrap="">
I have tried (Un)LockSelectionChange on the list, setting ItemIndex to
-1, all in the forms create method. I've tried using add() or assign()
on the listbox's Items, nothing helps.
The wiki on TListBox doesn't say anything on this topic, neither does
the LCL help document.
How can it be done?
</pre>
</blockquote>
<br>
<br /><br />
<hr style='border:none; color:#909090; background-color:#B0B0B0; height: 1px; width: 99%;' />
<table style='border-collapse:collapse;border:none;'>
<tr>
<td style='border:none;padding:0px 15px 0px 8px'>
<a href="http://www.avast.com/">
<img border=0 src="http://static.avast.com/emails/avast-mail-stamp.png" />
</a>
</td>
<td>
<p style='color:#3d4d5a; font-family:"Calibri","Verdana","Arial","Helvetica"; font-size:12pt;'>
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
<br><a href="http://www.avast.com/">www.avast.com</a>
</p>
</td>
</tr>
</table>
<br />
</body>
</html>