• Welcome to PlanetSquires Forums.
 

WFXlistview Header

Started by Petrus Vorster, August 05, 2022, 05:05:28 PM

Previous topic - Next topic

Petrus Vorster

Hi All

The Listview header is showing like a button.
(See Image)
Is there a way I can get that flat like in Powerbasic  listview?
I tried a number of setting changes, but dont seem to be able to change that.

-regards, Peter
-Regards
Peter

SeaVipe

Hi Peter,
I believe that will be addressed in a future release. I use ListView controls quite a bit and the only way that I can mitigate the appearance is to play with the colours.
Clive Richey

Paul Squires

Yeah, the Listview header is ownerdrawn in order to allow for better control over coloring, etc. The downside is that by using ownerdraw I am losing the Windows theming. When the time comes to fix this I will add a setting to the Listview control to either use or prevent ownerdraw.
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Petrus Vorster

Hi All

Some differences between Powerbasic and Freebasic still gets me a little.

How do I get the selected TEXT back from a listview?

I assume I need to get the Row with this:
selected = Settings.ListView1.SelectedIndex

How do I get the text back from the subitems in that row?

-regards, Peter
-Regards
Peter

SeaVipe

Hi Peter,

I use the following to retrieve text from a ListView Row/Col and create a ToolTip from the text in Col 3:
Function frmMain_lvMainDB_MouseMove( ByRef sender As wfxListView, ByRef e As EventArgs ) As LRESULT
' //  Set tooltiptext.
    Dim as long Row, Col
    Var HT = sender.HitTest(Row, Col)

    If HT = -1 Then
    
        sender.ToolTip = ""
        Return 0
    
    End If
    Dim newTip As WString * 500
   
    Select CASE Col
    
        CASE Is = 3 ' Notes/comments
' This line retrieves the text.
            Dim As String s = sender.Item(Row).SubItem(Col).Text
            newTip =  s
        
        CASE Else   : newTip = "" ' Nothing to display.
    
    End Select

    If Row = -1 Then newTip = "Zero"
    sender.ToolTip = newTip
 Function = 0
End function

For the large ToolTip text to be displayed you need to set this earlier in your program:
    ' Set the max width for the main ListView control's ToolTip text.
    ' This allows for multiline ToolTips.
    ' The use of WString * xxx (a value > 80) is probably required (I've not experimented with any other string variable)
    sendmessage( frmMain.lvMainDB.hWindowToolTip, TTM_SETMAXTIPWIDTH, 0, 501 )
I hope this is what you are looking for.
Clive Richey

Paul Squires

As Clive points out in his example, retrieve the subitem text like this:

Dim As CWSTR wszText = Form1.Listview1.Item(Row).SubItem(Col).Text
Paul Squires
PlanetSquires Software
WinFBE Editor and Visual Designer

Petrus Vorster

Thank you gents.

That's where I went wrong.
I was so close.

Thank you!

-Peter
-Regards
Peter