Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Textbox 2.0 Float Over MSHFlexGrid 1

Status
Not open for further replies.

RobHudson

Programmer
Apr 30, 2001
172
0
0
GB
I'm sure I'm not the first to have this issue, but I can't seem to find any advice :(

I have a MSHFlexGrid and a textbox from the Forms 2.0 Object Library. I am trying to do the usual trick of overlaying the textbox on the grid to allow for editing. Unfortunately, the textbox is not shown over the grid, it always stays under it.

This is the code being used in the grid click event:
Code:
    With grd
        txt.Text = .Text
        txt.Move .CellLeft + .Left, .CellTop + .Top, .CellWidth, .CellHeight
        txt.ZOrder 0
        txt.Visible = True
        txt.SetFocus
        DoEvents
    End With

Any ideas?

I am using Forms 2.0 controls as I need to handle unicode characters (which is working nicely).

Thanks :)
 
It appears that Forms 2 controls inhabit the same 'ZOrder layer' as the normal VB6 Label and Image Controls (i.e. the ones with no Hwnd property). Forms 2 controls lack the .Hwnd property too.

It does not seem possible to place them on top of other VB6 Contols using ZOrder in code or the 'Bring to Front' option in the IDE.
 
>Forms 2 controls lack the .Hwnd

They do have 'em - it's just difficult to ferret them out
 
VB6's DataGrid control is both ADO and Unicode enabled. Depending on your needs this might save you a lot of trouble. A lot of people fear and loathe data binding though.

Forms 2.0 has issues with reliability in a VB6 Form (though I've had no problems there) and more importantly redistribution (illegal).
 
Thanks everybody for your responses :)

I wasn't aware that the good old DataGrid was unicode enabled - should have tried that really :$

Using the DataGrid solves it for me.

@strongm: Out of interest, where is the Hwnd accessible from and with access to it, would you be able to force the overlay?

Thanks again :)
 
>where is the Hwnd accessible

Sorry, was half asleep when I wrote my comment. I was thinking of the Userform, which appears not to ahve an hWnd but actually does, rather than the Form 2.0 controls that go on such a form.
 
Don't confuse the DataGrid with its ancient counterpart the DBGrid. Like MSFlexGrid, this was only included to ease the porting of old programs to VB6.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top