Jump to content

Remove Arrows from Headers


Recommended Posts

How do I remove an arrow (possibly with _GUICtrlHeader_SetItemFlags() ) in a column header item. For instance, Windows Explorer has a column with an arrow and I want to remove it.

Does this make sense?

_GUICtrlHeader_SetItemFlags() basically doesn't have a remove arrow just a draw it in different directions.

ANSWER

Thanks Gary!

#439401

Edited by JohnBailey
A decision is a powerful thing
Link to comment
Share on other sites

How do I remove an arrow (possibly with _GUICtrlHeader_SetItemFlags() ) in a column header item. For instance, Windows Explorer has a column with an arrow and I want to remove it.

Does this make sense?

_GUICtrlHeader_SetItemFlags() basically doesn't have a remove arrow just a draw it in different directions.

I think it would have to be _GUIImageList_Destroy, but not sure you can do that on system control. Might even crash explorer.

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

I think it would have to be _GUIImageList_Destroy, but not sure you can do that on system control. Might even crash explorer.

Well, I don't want to destroy the header or the listview. I am just wanting to remove/undraw a drawn arrow.

The manual says for the setItemFlag

4 - Draws a down arrow on this item

8 - Draws a up arrow on this item

If there is already a drawn arrow (say on column two) and then I want to draw another arrow (say on column one) well I want to remove the previous arrow (so the arrow on column one).

SetItemFlag let's me draw an arrow, but doesn't let me remove the arrow.

A decision is a powerful thing
Link to comment
Share on other sites

Well, I don't want to destroy the header or the listview. I am just wanting to remove/undraw a drawn arrow.

The manual says for the setItemFlag

4 - Draws a down arrow on this item

8 - Draws a up arrow on this item

If there is already a drawn arrow (say on column two) and then I want to draw another arrow (say on column one) well I want to remove the previous arrow (so the arrow on column one).

SetItemFlag let's me draw an arrow, but doesn't let me remove the arrow.

After a little more research I think you can do what you want with _GUICtrlHeader_SetItemFormat

Edited by GaryFrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

#include <GuiConstantsEx.au3>
#include <GuiHeader.au3>
#include <GuiImageList.au3>
#include <WinAPI.au3>

Opt('MustDeclareVars', 1)

$Debug_HDR = False ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work

Global $iMemo

_Main()

Func _Main()
    Local $hGUI, $hHeader, $hImage

    ; Create GUI
    $hGUI = GUICreate("Header", 400, 300)
    $hHeader = _GUICtrlHeader_Create ($hGUI)
    $iMemo = GUICtrlCreateEdit("", 2, 24, 396, 274, 0)
    GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New")
    GUISetState()

    ; Create an image list with images
    $hImage = _GUIImageList_Create (11, 11)
    _GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0xFF0000, 11, 11))
    _GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x00FF00, 11, 11))
    _GUIImageList_Add ($hImage, _WinAPI_CreateSolidBitmap ($hGUI, 0x0000FF, 11, 11))
    _GUICtrlHeader_SetImageList ($hHeader, $hImage)

    ; Add columns
    _GUICtrlHeader_AddItem ($hHeader, "Column 1", 100, 0, 0)
    _GUICtrlHeader_AddItem ($hHeader, "Column 2", 100, 0, 1)
    _GUICtrlHeader_AddItem ($hHeader, "Column 3", 100, 0, 2)
    _GUICtrlHeader_AddItem ($hHeader, "Column 4", 100)

    ; Set column 1 format
    _GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_CENTER, $HDF_STRING, $HDF_SORTDOWN))

    ; Show column 1 format
    MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

    Sleep(1000)
    
    ; Reset column 1 format
    _GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_LEFT, $HDF_STRING, $HDF_IMAGE))

    ; Show column 1 format
    MemoWrite("Column 1 format: " & "0x" & Hex(_GUICtrlHeader_GetItemFormat ($hHeader, 0)))

    ; Loop until user exits
    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE
EndFunc   ;==>_Main

; Write a line to the memo control
Func MemoWrite($sMessage)
    GUICtrlSetData($iMemo, $sMessage & @CRLF, 1)
EndFunc   ;==>MemoWrite

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

GARY YOU ROCK!

Thanks !!! I'm just using a blank image list and that seems to do the trick.

Should be no reason to use a blank image list just use:

_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_LEFT, $HDF_STRING))

that should turn off the arrow

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Should be no reason to use a blank image list just use:

_GUICtrlHeader_SetItemFormat ($hHeader, 0, BitOR($HDF_LEFT, $HDF_STRING))

that should turn off the arrow

Works better than the blank image! Thanks

I didn't know that it could be done this way.

A decision is a powerful thing
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...