Jump to content

A list with fixed columns


ToyleY
 Share

Recommended Posts

I just want to display a table with 2 columns but I can't fix the column width and users can fiddle with the column widths when the program is run.

How do I specify the column widths and make them non-movable? Here is a pic of the problem and the code I'm using (I'm a bit new to this as you can see - so sorry if its a stupid question).

Posted Image

; LIST VIEW

$Mylist = GuiCtrlCreateListView(" Milestone Date| Milestone", 125, 47, 305, 80, 1, $LVS_REPORT)

$L1 = GuiCtrlCreateListViewItem(" 27 Jan 2007 | 14 days", $Mylist)

$L2 = GuiCtrlCreateListViewItem(" 27 Jan 2007|bla bla bla ", $Mylist)

$L3 = GuiCtrlCreateListViewItem(" 12 Feb 2007|bla bla bla", $Mylist)

$L4 = GuiCtrlCreateListViewItem(" 20 Feb 2007|bla bla bla", $Mylist)

$L5 = GuiCtrlCreateListViewItem(" 03 Mar 2007|bla bla bla", $Mylist)

$L6 = GuiCtrlCreateListViewItem(" 12 Mar 2007|bla bla bla", $Mylist)

$L7 = GuiCtrlCreateListViewItem(" 22 Apr 2007|bla bla bla", $Mylist)

GUICtrlSetFont ($Mylist, 10, 600)

GUICtrlSetBkColor($L1,0xFCEDDB)

GUICtrlSetBkColor($L3,0xFCEDDB)

GUICtrlSetBkColor($L5,0xFCEDDB)

GUICtrlSetBkColor($L7,0xFCEDDB)

Link to comment
Share on other sites

I just want to display a table with 2 columns but I can't fix the column width and users can fiddle with the column widths when the program is run.

How do I specify the column widths and make them non-movable? Here is a pic of the problem and the code I'm using (I'm a bit new to this as you can see - so sorry if its a stupid question).

Posted Image

; LIST VIEW

$Mylist = GuiCtrlCreateListView(" Milestone Date| Milestone", 125, 47, 305, 80, 1, $LVS_REPORT)

$L1 = GuiCtrlCreateListViewItem(" 27 Jan 2007 | 14 days", $Mylist)

$L2 = GuiCtrlCreateListViewItem(" 27 Jan 2007|bla bla bla ", $Mylist)

$L3 = GuiCtrlCreateListViewItem(" 12 Feb 2007|bla bla bla", $Mylist)

$L4 = GuiCtrlCreateListViewItem(" 20 Feb 2007|bla bla bla", $Mylist)

$L5 = GuiCtrlCreateListViewItem(" 03 Mar 2007|bla bla bla", $Mylist)

$L6 = GuiCtrlCreateListViewItem(" 12 Mar 2007|bla bla bla", $Mylist)

$L7 = GuiCtrlCreateListViewItem(" 22 Apr 2007|bla bla bla", $Mylist)

GUICtrlSetFont ($Mylist, 10, 600)

GUICtrlSetBkColor($L1,0xFCEDDB)

GUICtrlSetBkColor($L3,0xFCEDDB)

GUICtrlSetBkColor($L5,0xFCEDDB)

GUICtrlSetBkColor($L7,0xFCEDDB)

After you create the ListView you send it a message to set the column width like this

;Const $LVM_SETCOLUMNWIDTH = 0x101E;probably defined already

GUICtrlSendMsg($MyList,$LVM_SETCOLUMNWIDTH, 0, 80); where 0 is for col 0, 80 is the width of col 0

This is taken from GuiListView.au3, but unless you need lots of the functions in that then one line is sufficient.

I don't have a ready-made solution to stopping the columns from being resized;

This is an example of how it can be done in C shown at CodeProject

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Thanks martin, i wanted to do this a long time ago, now with the C example i done it!

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

Global Const $WM_NOTIFY = 0x004E
Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_ITEMCHANGINGW = $HDN_FIRST - 20

$GUI = GUICreate("Static Columns Demo!", 420, 240)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$ListView = GUICtrlCreateListView("Column1|Column2", 20, 20, 380, 200, $LVS_NOSORTHEADER)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")

GUICtrlCreateListViewItem("Item 1|SubItem 1", $ListView)
GUICtrlCreateListViewItem("Item 2|SubItem 2", $ListView)

GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, 80)

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

Func WM_NOTIFY_EVENTS($hWndGUI, $MsgID, $wParam, $lParam)
    Local $TagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return
    
    Local $iEvent = DllStructGetData($TagNMHDR, 3)
    If $iEvent = $HDN_ITEMCHANGINGA Or $iEvent = $HDN_ITEMCHANGINGW Then Return 1
    
    Return $GUI_RUNDEFMSG
EndFunc

Edit: Now the column will stay fixable even if we doubleclick on the columns delimeter.

Edited by MsCreatoR

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thanks martin, i wanted to do this a long time ago, now with the C example i done it!

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

Global Const $WM_NOTIFY = 0x004E
Global Const $HDN_FIRST = -300
Global Const $HDN_BEGINTRACKA = $HDN_FIRST-6
Global Const $HDN_BEGINTRACKW = $HDN_FIRST-26

$Accounts1 = GUICreate("GUI", 481, 294, 203, 126)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$ListView = GUICtrlCreateListView("Column1|Column2", 20, 20, 300, 200, $LVS_NOSORTHEADER)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")

GUICtrlCreateListViewItem("Item 1|SubItem 1", $ListView)
GUICtrlCreateListViewItem("Item 2|SubItem 2", $ListView)

GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, 80)

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

Func WM_NOTIFY_EVENTS($hWndGUI, $MsgID, $wParam, $lParam)
    Local $TagNMHDR = DllStructCreate("int;int;int;uint;uint;uint;int;int", $lParam)
    If @error Then Return
    
    Local $iEvent = DllStructGetData($TagNMHDR, 3)
    If $iEvent = $HDN_BEGINTRACKA Or $iEvent = $HDN_BEGINTRACKW Then Return 1
    Return $GUI_RUNDEFMSG
EndFunc

Well done MsCreatoR, a fast and neat job! :P

(You have still got the cursor to do though.)

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Well done MsCreatoR

Thanks to you ;)

You have still got the cursor to do though

Frankly i have no idea how to disable the cursor :P ...

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Edited my post with the example, now the column will stay fixable even if we doubleclick on the columns delimeter.

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

I think we need to catch $WM_SETCURSOR message to disable the cursor, but i tried hard, and without any seccess :P

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Thanks

I don't think the stuff below is any use - but it might be. Even when I use GUISetCursor or GUICtrlSetCursor, the cursor always goes to a resizer when it hits the divider in the column headers.

Try these 2 for cursor - 16 makes it disappear.

GUISetCursor ( [cursorID [, override [, winhandle]]] )

GUICtrlSetCursor ( controlID, cursorID )

0 = UNKNOWN (this includes pointing and grabbing hand icons) ???????

1 = APPSTARTING

2 = ARROW

3 = CROSS

4 = HELP

5 = IBEAM

6 = ICON

7 = NO

8 = SIZE

9 = SIZEALL

10 = SIZENESW

11 = SIZENS

12 = SIZENWSE

13 = SIZEWE

14 = UPARROW

15 = WAIT

16 = invisible

Here is a little test prog -

#include <GUIConstants.au3>

$IDC = -1

$newIDC = 0

HotkeySet("{Esc}", "Increment")

GUICreate("Press Esc to Increment", 400, 400,0,0,0x04CF0000, 0x00000110)

GUISetState ()

While GUIGetMsg()<> $GUI_EVENT_CLOSE

If $newIDC <> $IDC Then

$IDC = $newIDC

GUISetCursor($IDC)

EndIf

ToolTip("GUI Cursor #" & $IDC)

WEnd

Exit

Func Increment()

$newIDC = $IDC + 1

If $newIDC > 16 Then $newIDC = 0

EndFunc

Edited by ToyleY
Link to comment
Share on other sites

I found this for getting rid of the resize cursor in listview (on MDSN by nobugz Aug 2007) but i don't know how to convert it to autoit code.

Add a new class to your project and paste the code shown below. Build. Drag the new control from the top of your toolbox onto a form.

using System;

using System.Windows.Forms;

using System.Runtime.InteropServices;

public class FixedColumnView : ListView {

private HeaderWindow mHeader;

public FixedColumnView() {

this.View = View.Details;

}

protected override void WndProc(ref Message m) {

Console.WriteLine(m.ToString());

if (m.Msg == WM_DESTROY) {

// Un-subclass header control

if (mHeader != null) mHeader.ReleaseHandle();

mHeader = null;

}

if (m.Msg == WM_NOTIFY) {

// Prevent dragging

NMHDR nm = (NMHDR)m.GetLParam(typeof(NMHDR));

if (nm.code == HDN_BEGINTRACK) {

m.Result = (IntPtr)1;

return;

}

}

base.WndProc(ref m);

if (m.Msg == WM_CREATE) {

// Subclass the header control

IntPtr hWnd = SendMessage(this.Handle, LVM_GETHEADER, IntPtr.Zero, IntPtr.Zero);

if (mHeader == null || mHeader.Handle != hWnd) {

if (mHeader != null) mHeader.ReleaseHandle();

else mHeader = new HeaderWindow();

mHeader.AssignHandle(hWnd);

}

}

}

private class HeaderWindow : NativeWindow {

protected override void WndProc(ref Message m) {

if (m.Msg == WM_SETCURSOR) {

// Prevent cursor from changing

m.Result = (IntPtr)1;

return;

}

if (m.Msg == WM_LBUTTondblclick) {

// Prevent double-click from changing column

return;

}

base.WndProc(ref m);

}

}

// P/Invoke declarations

private const int WM_CREATE = 0x0001;

private const int WM_DESTROY = 0x0002;

private const int WM_SETCURSOR = 0x0020;

private const int WM_NOTIFY = 0x004e;

private const int WM_LBUTTondblclick = 0x0203;

private const int LVM_GETHEADER = 0x101f;

private const int HDN_FIRST = -300;

private const int HDN_BEGINTRACK = HDN_FIRST - 26;

[structLayout(LayoutKind.Sequential)]

private struct NMHDR {

public int hWndFrom;

public int idFrom;

public int code;

}

[DllImport("user32.dll")]

private static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wp, IntPtr lp);

}

Edited by ToyleY
Link to comment
Share on other sites

I think we need to catch $WM_SETCURSOR message to disable the cursor, but i tried hard, and without any seccess :P

No, I don't know how to do it either.

Here's another approach which would fool most people, but it only works for a standard XP theme so it's not really a solution unless you put a lot more effort into it. It needs someone like Siao to tell us the correct way.

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

$GUI = GUICreate("Static Columns Demo!", 420, 240)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$ListView = GUICtrlCreateListView("Column1|Column2", 20, 20, 380, 200, $LVS_NOCOLUMNHEADER)

GUICtrlCreateListViewItem("Item 1|SubItem 1", $ListView)
GUICtrlCreateListViewItem("Item 2|SubItem 2", $ListView)

GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg(GUICtrlGetHandle($ListView), $LVM_SETCOLUMNWIDTH, 1, 80)

GUISetState(@SW_SHOW)
LVHeader()

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc ;==>Quit

Func LVHeader();make a false header
    $linecol = 0x7E9BE5;could be obtained by pixelgetcolor on edge of listview
    GUICtrlCreateLabel('', 20, 3, 379, 1)
    GUICtrlSetBkColor(-1, $linecol)
    GUICtrlCreateLabel('', 20, 19, 379, 1)
    GUICtrlSetBkColor(-1, 0xBEDBff)
    GUICtrlCreateLabel('', 90, 6, 1, 12)
    GUICtrlSetBkColor(-1, 0x888888)
    GUICtrlCreateLabel('', 20, 3, 1, 18)
    GUICtrlSetBkColor(-1, $linecol)
    GUICtrlCreateLabel('', 399, 3, 1, 18)
    GUICtrlSetBkColor(-1, $linecol)
    GUICtrlCreateLabel('Column1', 24, 5, 40, 15, $WS_CLIPSIBLINGS)
    GUICtrlCreateLabel('Column2', 110, 5, 60, 15, $WS_CLIPSIBLINGS)
    
    
EndFunc ;==>LVHeader
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Nice workaround martin! :P

but it only works for a standard XP theme

Why, what's the reason that it can fail on other themes?

 

Spoiler

Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1

AutoIt_Rus_Community.png AutoIt Russian Community

My Work...

Spoiler

AutoIt_Icon_small.pngProjects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize Program

AutoIt_Icon_small.pngUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF
 
AutoIt_Icon_small.pngExamples: 
ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo

Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating AutoIt_Rating.gif)

* === My topics === *

==================================================
My_Userbar.gif
==================================================

 

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Link to comment
Share on other sites

Nice workaround martin! :P

Why, what's the reason that it can fail on other themes?

It won't fail but it won't look right if the theme draws the headers differently and uses different colours, so it might look wrong. That's why I put a note about getting the border colour, so at at least you could make sure the colour round the header matched the border drawn by Windows. You would also have to work out a lighter shade for the line at the bottom of the header which I did by guessing.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

  • 1 year later...

Thanks martin, i wanted to do this a long time ago, now with the C example i done it!

#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1)

Global Const $WM_NOTIFY = 0x004E
Global Const $HDN_FIRST = -300
Global Const $HDN_ITEMCHANGINGA = $HDN_FIRST - 0
Global Const $HDN_ITEMCHANGINGW = $HDN_FIRST - 20

$GUI = GUICreate("Static Columns Demo!", 420, 240)
GUISetOnEvent($GUI_EVENT_CLOSE, "Quit")

$ListView = GUICtrlCreateListView("Column1|Column2", 20, 20, 380, 200, $LVS_NOSORTHEADER)
GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY_EVENTS")

GUICtrlCreateListViewItem("Item 1|SubItem 1", $ListView)
GUICtrlCreateListViewItem("Item 2|SubItem 2", $ListView)

GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($ListView, $LVM_SETCOLUMNWIDTH, 1, 80)

GUISetState(@SW_SHOW)

While 1
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

Func WM_NOTIFY_EVENTS($hWndGUI, $MsgID, $wParam, $lParam)
    Local $TagNMHDR = DllStructCreate("int;int;int", $lParam)
    If @error Then Return
    
    Local $iEvent = DllStructGetData($TagNMHDR, 3)
    If $iEvent = $HDN_ITEMCHANGINGA Or $iEvent = $HDN_ITEMCHANGINGW Then Return 1
    
    Return $GUI_RUNDEFMSG
EndFunc

Edit: Now the column will stay fixable even if we doubleclick on the columns delimeter.

Hello,

is there a way to get this to work again?

I tested it with v3.3.3.0 and the current beta and it won't work. I think its a problem of Win 7... could anyone test this code under WinXP, or Vista with and then tell me if the columm header is moveable?

Thanks guys :)

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