Jump to content

[HELP] put a button or label in the header part of the list


 Share

Recommended Posts

Hello again, I am writing using Google Translate as I do not speak English. I'm sorry for that. Coming to the question, I learned from the site that the color of the title section of the list can be changed in different ways, but I could not adapt it to my own codes. As a solution, I thought of putting a button in the title section of the list and coloring it. Of course, while doing this, I turn the list off so that the list size is not adjusted and it would be nice if the button was colored, as it would look like the title color. But when I add a button, the button remains at the bottom of the list. How can I solve this?
 
 

sshot-1.png

Link to comment
Share on other sites

#RequireAdmin
#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiMenu.au3>
#include <WindowsConstants.au3>

$main = GUICreate("autoit", 400, 400)


$list = GUICtrlCreateListView("demo", 15, 15 , 300, 300)

GUICtrlSendMsg($list, $lvm_setcolumnwidth, 0, 290)

ControlDisable($main, "", HWnd(_GUICtrlListView_GetHeader($list)))

$button = GUICtrlCreateButton("new list header", 15, 10, 300, 40) ; The button must remain at the top of the list

GUICtrlSetColor($button, 0xcccccc)
GUICtrlSetBkColor($button, 0x191919)

GUISetState(@SW_SHOW, $main)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

The button must remain at the top of the list

Link to comment
Share on other sites

What exactly do you want to do? The controls are not drawn how do you think. If you don't want the list view header just use $LVS_NOCOLUMNHEADER as style and place a button above the list view, just don't overlap controls like that.

When the words fail... music speaks.

Link to comment
Share on other sites

38 minutes ago, Andreik said:

What exactly do you want to do? The controls are not drawn how do you think. If you don't want the list view header just use $LVS_NOCOLUMNHEADER as style and place a button above the list view, just don't overlap controls like that.

$LVS_NOCOLUMNHEADER when I remove the title with this method $lvs_ex_checkboxes not actived

Link to comment
Share on other sites

I don't know what are you talking about. $LVS_EX_CHECKBOXES it's not used by default but what stops you to use it?

;~ #RequireAdmin
#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
;~ #include <GuiMenu.au3>
#include <WindowsConstants.au3>

$main = GUICreate("autoit", 400, 400)


$list = GUICtrlCreateListView("demo", 15, 50 , 300, 300, $LVS_NOCOLUMNHEADER, $LVS_EX_CHECKBOXES)
GUICtrlSendMsg($list, $lvm_setcolumnwidth, 0, 290)

GUICtrlCreateListViewItem('Test', $list)

$button = GUICtrlCreateButton("new list header", 15, 10, 300, 40) ; The button must remain at the top of the list
GUICtrlSetColor($button, 0xcccccc)
GUICtrlSetBkColor($button, 0x191919)

GUISetState(@SW_SHOW, $main)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

When the words fail... music speaks.

Link to comment
Share on other sites

18 minutes ago, Andreik said:

I don't know what are you talking about. $LVS_EX_CHECKBOXES it's not used by default but what stops you to use it?

;~ #RequireAdmin
#NoTrayIcon
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
;~ #include <GuiMenu.au3>
#include <WindowsConstants.au3>

$main = GUICreate("autoit", 400, 400)


$list = GUICtrlCreateListView("demo", 15, 50 , 300, 300, $LVS_NOCOLUMNHEADER, $LVS_EX_CHECKBOXES)
GUICtrlSendMsg($list, $lvm_setcolumnwidth, 0, 290)

GUICtrlCreateListViewItem('Test', $list)

$button = GUICtrlCreateButton("new list header", 15, 10, 300, 40) ; The button must remain at the top of the list
GUICtrlSetColor($button, 0xcccccc)
GUICtrlSetBkColor($button, 0x191919)

GUISetState(@SW_SHOW, $main)

While 1
    $nmsg = GUIGetMsg()
    Switch $nmsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

 

this work thnx

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...