Choose icon in TParamListBox?

I was playing around with the TParamListBox to see if I could select an icon. I tried setting it up as a Custom Edit item and put the inside of it. It showed the icon like I wanted. So with an event for OnParamCustomEdit() I extracted the icon index, put up a dialog to select the icon, then set the value. The new value showed as the raw text and didn't change the icon itself. Here's my test code to see if I could get this to work:

void __fastcall TSettingsForm::ParamListBox1ParamCustomEdit(TObject *Sender, int idx,
          UnicodeString href, UnicodeString value, UnicodeString props, TRect &EditRect)

	int pos=value.Pos(_T("idx:"));
	TImageIndex ii=_tcstoul(value.SubString(pos, 4).t_str(), NULL, 10);
	if (TIconSelectionForm::SelectIcon(this, ii)==mrOk) {
		value.sprintf(_T("<IMG src=\"idx:%i\">"), ii);
		TParamListBox *plb=dynamic_cast<TParamListBox *>(Sender);
		if (plb) {

Is there some way to easily do what I want? It's almost there, just setting the value doesn't result with the changed icon (it shows the icon and then the raw text).


Can you try to implement OnParamEditDone and in this event handler, return the value <IMG src=...> via the 'var value' parameter?

On the sample the pos needs pos+=4. However OnParamEditDone was not called for the custom edit item, it only was on the normal items?

I forgot the source as included - I did a quick check on why it may not be changing the icon, it looks like the call to HTMLPrep() is the reason - it must not do it on the initial value set but any change gets encoded?

So may I request an new feature in selecting an image idx - In my case 16x16 imagelist is used, when I click on the icon i prompt for new icon index, then I set it. With the new feature maybe it just gives the idx to use and set, done, and easy.

Here's the idea: New class "IMG"

Default Icon: <a href="iconidx" class="IMG">srcval</a>

Just uses the call back like the "CUSTOM" class.

Then you basically use <IMG src="srcval"> like <IMG src="idx:1">

We'll consider this for a future update.