Hi,
I had to contend with these issues whilst writing the egrid control and they are far from trivial!

Placing the controls is one thing, keeping them positioned whilst the user scrolls the list icon or drags columns or resizes a column is an entirely different matter!
Anyhow, I'll see if I can shed any light.
First thing to say is that these controls you wish to embed within the ListIcon should be made child's of the listicon. I'd say don't waste your time tyring to position controls which are not child controls of the list icon, this is asking for trouble!
1) Once the list icon has been created, it is not necessarily a good idea to change the row height. Is it not a better idea, when creating the child control, to size this accordingly - i.e. make it fit the dimensions of the cell which the user has clicked?
2)
Code: Select all
#LVM_SUBITEMHITTEST = #LVM_FIRST+57
If OpenWindow(0, 100, 100, 300, 100, "ListIcon Example", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
If CreateGadgetList(WindowID(0))
ListIconGadget(0, 5, 5, 290, 90, "Name", 100, #PB_ListIcon_AlwaysShowSelection)
AddGadgetColumn(0, 1, "Address", 250)
AddGadgetItem(0, -1, "Harry Rannit"+Chr(10)+"12 Parliament Way, Battle Street, By the Bay")
AddGadgetItem(0, -1, "Ginger Brokeit"+Chr(10)+"130 PureBasic Road, BigTown, CodeCity")
Repeat
Event = WaitWindowEvent()
If event=#WM_LBUTTONDOWN
Define PInfo.LVHITTESTINFO
GetCursorPos_(rc.POINT)
MapWindowPoints_(0, GadgetID(0),rc,1)
PInfo\pt\x = rc\x
PInfo\pt\y = rc\y
SendMessage_(GadgetID(0), #LVM_SUBITEMHITTEST, 0, PInfo)
Debug "("+Str(PInfo\iItem)+", "+Str(PInfo\iSubitem)+")"
EndIf
Until Event = #PB_Event_CloseWindow
EndIf
EndIf
I found early on in the development of egrid that the zero column of the underlying listicon could throw a spanner in the works. Just try the above code and click any non-text part of a cell in column 0 to see what I mean. For this reason (amongst many), I always blanked out the zero column, i.e. set it's width to zero. Of course this depends on your requirements whether you should follow suit.
Aligning the controls to exactly fit the cell in question is a royal pain in the a***! To avoid massive flicker you need to account for gridlines (if any are present?)
It seems that your program will need to place a child control when the user clicks a cell, i.e. the control is removed as soon as focus moves to another cell. This means that only one of each type of supported control needs to be created, which I think is the best way. In itself this is fine, except if you wish to align the text in the control perfectly with the text in the underlying cell. This took me days to get this right (but then I did have to account for the text justification etc.)
The following post might prove useful:
http://www.purebasic.fr/english/viewtop ... s+listicon
I'm not sure if all this helps.
I may look like a mule, but I'm not a complete ass.