View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Radu Radu is offline
external usenet poster
 
Posts: 13
Default VBA Excel - Textbox disappearing BEHIND listview control - Zorder is useless.

Hi. I have the following problem: On a userform I need to show some
(editable) data in a grid. I am using a listview control.

Since for some unknown reason the HitTest method refuses to work when
in Report mode, giving me erorrs even if I have a single line in the
HitTest event: "debug.print X" !!!, on MouseUp I detect (with
SendMessage(lsvTruckingCharges.hWnd, LVM_SUBITEMHITTEST, 0&, hti)) the
subitem the user has clicked on. Now I need to position a textbox/a
combo box/a date-time picker in the cell's place, for editing,
depending on the column's type.

I have started testing with a texbox, with the code (snip):

With txtFloat
'Set its text:
.Text = lsvTruckingCharges.ListItems(lngRow +
1).ListSubItems(lngCol)
.SelStart = 0
.SelLength = Len(.Text)

'Set its dimensions:
.Width = lsvTruckingCharges.ColumnHeaders(lngCol + 1).Width
.Height = lsvTruckingCharges.ListItems(lngRow + 1).Height

'Position it:
.Left = lsvTruckingCharges.Left +
lsvTruckingCharges.ColumnHeaders(lngCol + 1).Left
.Top = lsvTruckingCharges.Top +
lsvTruckingCharges.ListItems(lngRow + 1).Top
End With

The problem is that the textbox DISAPPEARS behind the listview, and no
amount of Zorder will show it. What can I do ? Where is the problem
?????? I did something similar in VB (not VBA) and it works like a
charm. Do ai have any alternatives ?

Thanks a lot
Alex. Nitulescu