Sign in to follow this  
Followers 0
MrCreatoR

GUIListViewSysLink UDF!

18 posts in this topic

#1 ·  Posted (edited)

Hi!

This whole concept belongs to rasim, and the idea of SysLink control inside ListView belongs to ptrex! He proposed it, and i thought that this will be a good challenge/practic for me! :P

Here we go...

#cs
    Name:               GUIListViewSysLink.au3
    Description:        Functions to set Hyperlink (via SysLink control) for ListView items.
    Author:             G.Sandler (a.k.a MrCreatoR), initial concept idea by R.Gilman (a.k.a rasim), this UDF idea by ptrex!
    AutoIt version:     3.2.12.1 - 3.3.8.1
    UDF version:        1.2
#CE

Example:

#include "GUIListViewSysLink.au3"

$hGUI = GUICreate("ListView with SysLink Control!", 420, 530, -1, -1, BitOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))

$hListView1 = GUICtrlCreateListView("Files|Path|Links", 10, 10, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlCreateListViewItem("AutoIT|C:\Program Files\AutoIt3", $hListView1)
GUICtrlCreateListViewItem("Opera|C:\Program Files\Opera", $hListView1)
GUICtrlCreateListViewItem("Script|C:\MyScripts", $hListView1)

$nSysLinkBkColor = 0xC0C0C0
$nSysLinkStockObject = $LTGRAY_BRUSH

$hListView2 = GUICtrlCreateListView("Name|Links", 10, 270, 400, 240, BitOR($LVS_REPORT, $WS_BORDER, $WS_CLIPSIBLINGS))
GUICtrlCreateListViewItem("Some Name", $hListView2)

$hSysLink1  = _GUICtrlListView_SysLinkCreate($hListView1, "AutoIt Script Home Page", "http://autoitscript.com", 0, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink2  = _GUICtrlListView_SysLinkCreate($hListView1, "Opera Home Page", "http://opera.com", 1, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink3  = _GUICtrlListView_SysLinkCreate($hListView1, "My Scripts Home Page?", "http://creator-lab.ucoz.ru", 2, 2)
_GUICtrlListView_SysLinkSetFont(-1, "Tahoma", 9.5)

$hSysLink1_2  = _GUICtrlListView_SysLinkCreate($hListView2, "Some other Home Page", "http://creator-lab.ucoz.ru", 0, 1)
_GUICtrlListView_SysLinkSetFont(-1, "Arial", 10.5)

GUICtrlSetBkColor($hListView1, $nSysLinkBkColor)
GUICtrlSetBkColor($hListView2, $nSysLinkBkColor)

GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 0, 80)
GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 1, 150)
GUICtrlSendMsg($hListView1, $LVM_SETCOLUMNWIDTH, 2, 120)

GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 0, 230)
GUICtrlSendMsg($hListView2, $LVM_SETCOLUMNWIDTH, 1, 115)

;Here we add ID to the $hSysLink1
_GUICtrlListView_SysLinkSetLinkInfo($hSysLink1, "http://autoitscript.com", "AutoIt")

;And now we check if it was added :)
$aInfo = _GUICtrlListView_SysLinkGetLinkInfo($hSysLink1)
$sInfo = StringFormat("Info For $hSysLink1:\n\nSysLink State\t\t= %i\nURL\t\t\t= %s\nID\t\t\t= %s\nParent ListView Handle\t= %s", _
    $aInfo[1], $aInfo[2], $aInfo[3], $aInfo[4])

ConsoleWrite($sInfo)

GUISetState(@SW_SHOW, $hGUI)

While GUIGetMsg() <> $GUI_EVENT_CLOSE
WEnd

The UDF and this example attached bellow.

P.S

Feedbacks and bug reports are always welcome!

GUIListViewSysLink_1.2.zip

ListView_SysLink_1.1.zip

ListView_SysLink_1.0.zip

Test Version (with Label control):

ListView_Link_TestVersion.zip

History version:

v1.2 [13.01.2013]

* AutoIt 3.3.8.1 compatibility.

* UDF renamed to GUIListViewSysLink.au3.

* Fixed issue when clicking on link does not executed properly.

* Fixed an issue with wrong SysLink control position set after resizing.

If "Display window content when draging" is disabled in Performance options, resizing was wrong.

v1.1 [21.10.2008]

+ Added handler to activate the main window when SysLink control is focused.

This handler also set hot cursor ($OCR_NO) while user trying to drag the SysLink control.

+ Added 2 more functions:

_GUICtrlListView_SysLinkSetLinkInfo() - Sets link information.

_GUICtrlListView_SysLinkGetLinkInfo() - Gets link information.

+ Added WM_CTLCOLORSTATIC registration to set bk color for the SysLink control.

(To change the color just set $nSysLinkBkColor variable to desired color).

* Rewrited parameters for the _GUICtrlListView_SysLinkCreate() function...

* $sTextFormat splitted into different 3 parameters: $sTitle, $sLink and $iLnkID.

* Added $iFillItemText - Allows to fill item text (SysLink text),

so the LV item will have the same text as SysLink control. Default is 1.

* Fixed inactive GUI window after executing url.

v1.0 [10.10.2008]

* First release.

Enjoy! Posted Image

Edited by MrCreatoR

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

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

Share this post


Link to post
Share on other sites



MrCreatoR

Good work. Thank you! :P

Share this post


Link to post
Share on other sites

Very Nice! Thanks!

Share this post


Link to post
Share on other sites

Good work here... a suggestion I'd make is to get the back ground color of the listview and paint the background color of the CreateWindowEx the same :(... You two seem to feed of each other well :P .


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

@SmOke_N

I am just kicking the ball, it is MrCreatoR and ProgAndy who is scoring here !! :P

Anyhow this is a very nice addition to the standard listView.

Regards,

ptrex

I was speaking of Rasim :( ... Both have produced some nice Listview alternatives/options. That's who I was referring to by feeding well off of one another (I mistyped in my other post, I put "Feed of" rather than "Feed off").

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Thanks for the feedbacks!

@SmOke_N

a suggestion I'd make is to get the back ground color of the listview and paint the background color of the CreateWindowEx the same

Actualy i tried that, i spent on this issue more time than on building the UDF itself :(

How to set background color for window created with _WinAPI_CreateWindowEx() ?

And what is the best way to get Background color of ListView control?

This one not working:

$hDC = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hLV)
$hDC = $hDC[0]

$nColor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)

It returns FFFFFF (white) always :P

Edited by MrCreatoR

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

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

Share this post


Link to post
Share on other sites

For setting the bg color, experiment with the WM_CTLCOLOR* messages. I don't know which one, if any, that a syslink control sends though. Here's the msdn -

http://msdn.microsoft.com/en-us/library/bb432504(VS.85).aspx

I don't see a call on 32 bit system for SysLink control ...

Thanks for the feedbacks!

@SmOke_N

Actualy i tried that, i spent on this issue more time than on building the UDF itself :(

How to set background color for window created with _WinAPI_CreateWindowEx() ?

And what is the best way to get Background color of ListView control?

This one not working:

$hDC = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hLV)
$hDC = $hDC[0]

$nColor = DllCall("GDI32.dll", "int", "GetBkColor", "hwnd", $hDC)

It returns FFFFFF (white) always :P

This is a similar issue I had here: http://www.autoitscript.com/forum/index.php?showtopic=65802

I reformatted it a bit using wraithdu's and googles suggestion: http://cboard.cprogramming.com/archive/ind...hp/t-91110.html :

Func _GUISetSysLinkBkColor($h_parent, $h_wnd, $i_color = 0xFFFFFF)
    Local Const $GCL__HBRBACKGROUND  = -10
    Local Const $RDW__ERASE          = 0x04
    Local Const $RDW__INVALIDATE        = 0x01
    Local Const $RDW__ALLCHILDREN      = 0x080
    Local Const $RDW__UPDATENOW      = 0x100
    Local Const $WM__CTLCOLORSTATIC  = 0x00138

    Local $i_color_bgr = _
                        BitOR(BitShift(BitAND($i_color, 0x000000FF), 16), _
                        BitAND($i_color, 0x0000FF00), _
                        BitShift(BitAND($i_color, 0x00FF0000),16))
                        
    Local $h_dc = DllCall("User32.dll", "hwnd", "GetDC", "hwnd", $hSysLink1)
    If @error Then Return SetError(1, 0, 0)
    
    Local $h_sm = DllCall("User32.dll", "hwnd", "SendMessage", "hwnd", $h_parent, "uint", $WM__CTLCOLORSTATIC, "wparam", $h_dc[0], "lparam", $h_wnd)
    If @error Then Return SetError(2, 0, 0)
    
    Local $i_scl = DllCall("User32.dll", "int", "SetClassLongA", "hwnd", $h_wnd, "int", $GCL__HBRBACKGROUND, "dword", $h_sm[0])
    If @error Then Return SetError(3, 0, 0)
    
    DllCall("User32.dll", "int", "DeleteObject", "long", $i_scl[0])
    DllCall("User32.dll", "int", "InvalidateRect", "hwnd", $h_wnd, "int", 0, "int", 1)
    DllCall("User32.dll", "int", "RedrawWindow", "hwnd", $h_wnd, "int", 0, "int", 0, "uint", _
                BitOR($RDW__ERASE, $RDW__INVALIDATE, $RDW__ALLCHILDREN, $RDW__UPDATENOW))
    DllCall("User32.dll", "int", "UpdateWindow", "hwnd", $h_wnd)
    DllCall("User32.dll", "int", "ReleaseDC", "hwnd", $h_wnd, "hwnd", $h_dc[0])
    Return 1
EndFunc
But still the same issue :idea: ... I'll be curious to see this be accomplished for more than one reason obviously :) ...

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I spent 2 more hours (or maybe more) on this, this function has suffered a lot from me :P But no luck either :)

In the end(?) i came up with two workarounds:

1) Change the background color of ListView control :( - Not so preferable.

2) Instead of SysLink control use standard labels on top of new GUI (as framework), and handle the clicks with some timer function.

For the first one just add this to the top of _GUICtrlListView_SysLinkCreate function:

Local $nBkColor = _WinAPI_GetSysColor($COLOR_3DFACE)
    GUICtrlSetBkColor($hWnd, $nBkColor)

(before «If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)»).

About the second one, later i will post test-version (to see if it's good enough :idea: ).


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

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

Share this post


Link to post
Share on other sites

UDF updated!

History:

; v1.0 [10.10.2008, 02:20]

; First release.

;

; v1.1 [21.10.2008, 00:03]

; - Added handler to activate the main window when SysLink control is focused.

; This handler also set hot cursor ($OCR_NO) while user trying to drag the SysLink control.

;

; - Added 2 more functions:

; _GUICtrlListView_SysLinkSetLinkInfo() - Sets link information.

; _GUICtrlListView_SysLinkGetLinkInfo() - Gets link information.

;

; - Added WM_CTLCOLORSTATIC registration to set bk color for the SysLink control.

; (To change the color just set $nSysLinkBkColor variable to desired color).

;

; - Rewrited parameters for the _GUICtrlListView_SysLinkCreate() function...

; * $sTextFormat splitted into different 3 parameters: $sTitle, $sLink and $iLnkID.

; * Added $iFillItemText - Allows to fill item text (SysLink text),

; so the LV item will have the same text as SysLink control. Default is 1.

;

; - Fixed inactive GUI window after executing url.

I also added mentioned before Test version (with Label control), please see first post.

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

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

Share this post


Link to post
Share on other sites

hummm getting in 3.3.6.1 an error message :unsure:

C:\Program Files\AutoIt3\Include\_ListView_SysLink.au3(59,31) : ERROR: $HDN_FIRST previously declared as a 'Const'

Global Const $HDN_FIRST = -300

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

C:\~\test3.au3 - 1 error(s), 0 warning(s)

maybe u can do something whit it :>

i don't ;)


as finishing touch god created the dutch

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Delete the line with the error message, it's already been declared in one of the other included files, HeaderConstants.au3 in this case.

EDIT:typo

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

This is awesome and it helped me to create a link for my tool... but if i click on the link nothing happens how to make work ?


Thank you,Regards,[font="Garamond"][size="4"]K.Syed Ibrahim.[/size][/font]

Share this post


Link to post
Share on other sites

Update (after 4 years! :lmao: ):

v1.2 [13.01.2013]

* AutoIt 3.3.8.1 compatibility.

* UDF renamed to GUIListViewSysLink.au3.

* Fixed issue when clicking on link does not executed properly.

* Fixed an issue with wrong SysLink control position set after resizing.

If "Display window content when draging" is disabled in Performance options, resizing was wrong.


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

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

Share this post


Link to post
Share on other sites

Hello MrCreatoR,

I recently found your solution for the hyperlinks for listviews and found it really helpfull. I almost got my Autoit applicaton running however stumbled over a problem I have difficulties to resolve. It might be quite trivial for you and hopefully you can help. I am using your GUIListViewSysLink code to actually show hyperlinks in a listview which have prior been extracted from a text file. Hence the string containing the address (in my case it will be a file path) will need to be stored assigned to a variabel first and then will need to be handed over to your function. Here is the line of code where the problem starts:

...

_GUICtrlListView_SysLinkCreate($listview, "Update", $link, $i-1, 4)

...

Here the $link variable contains a simple string such as "C:tempupdate.bat". and it really needs to be a variable to allow changing hyperlinks. When executing my code I don't get a hyperlink in the corresponding column but rather something like:
<a href="C:tempupdate.bat""

I might have forgotton some other parameters. Could you help me out here? I hope the info I provided is sufficient.

Would really appreciate your help.

Regards,

hudehade

Share this post


Link to post
Share on other sites

When executing my code I don't get a hyperlink in the corresponding column but rather something like:

<a href="C:tempupdate.bat""

 

Hi,

I have tested the issue with variable, and it's working fine:

$sLink = 'c:\test.txt'
$hSysLink  = _GUICtrlListView_SysLinkCreate($hListView, "Update", $sLink, 0, 1)

Perhaps something wrong with the index values, can you show me the full code? Or a part with the ListView and UDF called in a loop?


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

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0

  • Similar Content

    • drapdv
      By drapdv
      I have a GUI with a parent window that has a menu and shortcut buttons at the top, and a child window which displays a list which is scrolled vertically.
      When the list is relatively small, like no more than 100 or so lines then it scrolls fine.  As the list gets larger, scrolling begins to slow, and if you start mixing up the scroll method (mousewheel, left-clicking the scrollbar box, etc) then it begins to hang.  When it hangs, dwm.exe CPU usage maxes out, and I can't even switch to another window.  Each line in the list is 1000px wide X 30px tall, and the lines alternate between a gray background and a white background, in case that matters.
      When a non-Aero theme is active, everything works fine.  So, I could disable DWM every time someone fires it up, but changing a client's color scheme is not ideal.
      I tried to utilize _WinAPI_DwmSetWindowAttribute($oGui_Parent,  $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED), and although it succeeds in disabling DWM for that window, it doesn't seem to make any difference as far as the scrolling lag is concerned.
      The code is several thousand lines long and contains proprietary information, so I'm trying to avoid posting that, but these are the lines which are creating the GUIs.  Is there anything that anyone can think of off the top of their heads, or is there anything jumping out at you from this snippet of code?  Any help is appreciated!
      $oGui_Parent = GUICreate("Data Viewer", 700, 500, Default, Default, BitOR($WS_CAPTION, $WS_MINIMIZEBOX, $WS_POPUPWINDOW)) WinSetTrans($oGui_Parent, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Parent, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF) $oGui_Child = GUICreate("", 700, 400, 0, 100, $WS_POPUP, $WS_EX_MDICHILD, $oGui_Parent) WinSetTrans($oGui_Child, "", 255) _WinAPI_DwmSetWindowAttribute($oGui_Child, $DWMWA_NCRENDERING_POLICY, $DWMNCRP_DISABLED) GUISetFont(9, 500, 0, "Calibri") GUISetBkColor(0xFFFFFF)  
    • TheSaint
      By TheSaint
      I had a need, and so I developed.
      Before I did that though, I did a quick search of the forum, and found a few things, but none seemed to suit what I really wanted ... though to be honest, I did not investigate them deeply or search extensively. In any case, I am not very good at modifying the code of others, nor do I enjoy doing so, so in the end I decided it was best to start from scratch ... re-inventing the wheel perhaps, but a wheel I feel a certain degree of comfort with. I also thought about Maps, but don't know enough.
      _IniString Functions (was Ini_InMem)
      Ini in memory
      Settings INI - Read/Write once to the disk
      INI File Processing Functions
      ... sure to be others.
      As with all my stuff, feel free to use (no guarantees) or modify ... just give me credit where due.
      I always go for the quick & simple approach, as those who know me here, are well aware, so without a doubt, my code could be improved - sped up, RegExp used, etc. So feel free to do that, and convert into a proper UDF, if you want, following best practices etc, as I am sure others will appreciate it.
      Recently, I have come upon a need to extract data from an approximately 50 Mb downloaded Index file, just extracting the few elements I need, and storing them in an INI file. It is quite a time consuming process, especially on my underpowered Netbook, which is where I am using the program I built. I have been considering ways to speed up things. Two good sounding methods, out of several possibles, have come to mind - 1) RAM Disk and 2) Virtual INI processing. That last being a better option, when sharing code (program) with others.
      Another method, which I am currently using, that did give me some measurable benefit, was to download the almost 50 Mb Index file in Stages (i.e. 30 x 1.4 Mb roughly), extracting data from each in turn. I have also considered extracting to 10 (or 11) separate INI files, rather than the single large INI file (4~5 Mb), as things noticeably slow up as the INI file increases in size ... obviously due to writing time.
      I can't really speed up the extraction process, but that last method may speed up the writing stage.  However, it would require significant program changes, and perhaps not gain me much benefit. To complicate things, there are too many Section names (Index ID's) for the IniReadSectionNames command, so I have had to split them off into their own (read/write) line-by-line index file, and create code to deal with duplicates. When read, Index ID's and Titles populate a Listbox control in a user GUI.
      So at this point in time, it seems best to use the Virtual INI approach to gain a significant reduction in time taken. For my own specific use, with my slow Netbook, I may also use a RAM Disk.
      Due to the aforementioned INI issues, and lack of available specific data, probably because it is always  program concentric, I have created an ASCII Checker program, which I guess you can say, is AutoIt  concentric. Because others may also find it handy, I am providing it here. NOTE - As yet, I am only aware that Escape characters exist, but have not investigated or catered for them in any way.
      ASCII Checker.zip

      The Virtual_INI_UDF is still a work in progress, though I have done most of the functions now, with the working but incomplete _Ini_Test function, still requiring changes etc from the information gleaned by the ASCII Checker program.
      Here's something to play with meanwhile.
      Updated files (24th February 2017)
      Virtual_INI_UDF.au3  NEW
      Example.au3 (23rd February 2017)
      All pretty basic, but managed to load my 4 Mb INI file (seemingly ok, but took a few seconds) ... though I have only worked with much smaller testing ones so far.
      P.S. While I have done a fair amount of testing, it has been pretty basic, and mostly limited to the examples provided. Testing has definitely not been extensive.
       
    • siva1612
      By siva1612
      I would like to create a window like the one shown below. The requirements are as below
      1. The title bar should be opaque.
      2. The parent window/Main screen will be below the side menu/child window
      3. The left side of the side menu window should be opaque.
      4. The right side should be semi-transparent. 

       
      Any idea to help?
    • Lights_On
      By Lights_On
      Hi all,

      I am having a little trouble with ‘GUICtrlSetResizing’ an hoping someone could push me in the direction of best practice.

      I have a basic GUI created to a set size with the enabled abilities to resize it:

      GUICreate("Test", 500, 450, -1, -1, BitOR($WS_SIZEBOX, $WS_MAXIMIZEBOX, $WS_MINIMIZEBOX))

      Inside this I have an image and label:

      GUICtrlCreateLabel($Image1StampInfo, 10, 395, 480, 20, $SS_CENTER) GUICtrlCreatePic($TheImage, 25, 25, 450, 350)

      Using:

      Case ($GUI_EVENT_MAXIMIZE or $GUI_EVENT_RESTORE or $GUI_EVENT_RESIZED)

      I activate:

       
      GUICtrlSetResizing($TheImageBox, $GUI_DOCKAUTO) GUICtrlSetResizing($Image1Stamp, $GUI_DOCKAUTO)

      This works fine with the image but not with the label – the label after a bit of resizing seems to get stuck in different places in the GUI as if the $GUI_DOCKAUTO has not worked properly.

      So 2 questions if I may. 

      1)    Have I used $GUI_DOCKAUTO incorrectly for use with lables?

      2)    I am happy to manually set new sizes dynamically but how? I can get the size of the window with ‘WinGetPos()’ but how do I set new size parameters for the ‘label’ and ‘image’?

      Thank you in advance.

    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening guys ( almost good night here in Italy )  
      How are you? Hop you're fine  
      I'm trying to do a Login Form ( I did, but I'm missing something in the management ), that allows the user to login when the script is launched, and, when the main GUI is opened, the user can Logout and Login with another username and password.
      The username and password "checking" I do is done by a text file, which in there are username and password, crypted through _Crypt_EncryptData().
      The "issue" I'm having at the moment, is to manage the Login form when the user hasn't already done the login, and so, the main GUI is not visible, but is created...
      I create the main GUI after the Login form... I tried with WinActive, WinGetState, but nothing changed ( even at the first Login, the script says ( through a MsgBox ) that the Win does exists ( or is active... ) and, as I want, it is not shown again...

      I really don't know If I missed something, or, I don't know...
      I'm going crazy for this thing...
      If someone could help me, I'd really appreaciate it!
      Thanks for the reading
      #Region ### START Koda GUI section ### Form=C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\form_Login.kxf Global $form_Login = GUICreate("Effettua il Login per continuare:", 405, 120, @DesktopWidth/2 - 202.5, @DesktopHeight/2 - 150) ; 302, 218 GUISetOnEvent($GUI_EVENT_CLOSE, "GUIDeleteLogin") Global $combo_Username = GUICtrlCreateCombo("Di Muro Francesco", 104, 64, 217, 25) GUICtrlSetFont(-1, 10, 400, 0, "Arial") GUICtrlSetData($combo_Username, "somedata") Global $input_Password = GUICtrlCreateInput("", 104, 89, 217, 25, BitOR($GUI_SS_DEFAULT_INPUT,$ES_PASSWORD)) GUICtrlSetFont(-1, 10, 400, 0, "Arial") $button_VerificaDati = GUICtrlCreateButton("", 328, 66, 42, 42, $BS_ICON) GUICtrlSetImage(-1, "C:\Users\Portatile-60\Documents\Documenti Lavoro\AutoIt\Gestione_Magazzino_v2\Icone\icon_check.ico", -1) GUICtrlSetOnEvent($button_VerificaDati, "CheckLogin") $label_Titolo = GUICtrlCreateLabel("Login", 167, 14, 71, 33) GUICtrlSetFont(-1, 18, 800, 0, "Arial") $label_Username = GUICtrlCreateLabel("Username :", 24, 64, 76, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") $label_Password = GUICtrlCreateLabel("Password :", 24, 89, 73, 20) GUICtrlSetFont(-1, 10, 800, 0, "Arial") #EndRegion ### END Koda GUI section ### Func CheckLogin() Local $sUsername = GUICtrlRead($combo_Username) Local $sPassword = GUICtrlRead($input_Password) MsgBox($MB_ICONINFORMATION, "", "Username: " & $sUsername & @CRLF & "Password: " & $sPassword) Local $sFileUtenti = @ScriptDir & "\utenti.txt" If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la lettura del file!") Exit Else Local $hFileUtenti = FileOpen($sFileUtenti, $FO_READ) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file " & $sFileUtenti & "." & @CRLF & "Errore: " & @error) Else Local $sDatiUtente, $aDatiUtente Local $bUtenteTrovato = False Local $iLinea = 1 Local $sControlloWin = "" Local $sWin = WinGetState($form_GestioneMagazzino) MsgBox($MB_ICONINFORMATION, "", $sWin) If @error Then MsgBox($MB_ICONERROR, "Errore!", "Errore durante la verifica della GUI attiva." & @CRLF & "Errore: " & @error) EndIf If($sWin == 5) Then MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True Else MsgBox($MB_ICONINFORMATION, "", "La GUI esiste!") Do $sDatiUtente = FileReadLine($hFileUtenti, $iLinea) $aDatiUtente = StringSplit($sDatiUtente, "|", $STR_NOCOUNT) If(BinaryToString(_Crypt_DecryptData($aDatiUtente[0], "CRYPT", $CALG_RC4)) = $sUsername And BinaryToString(_Crypt_DecryptData($aDatiUtente[1], "CRYPT", $CALG_RC4)) = $sPassword) Then $sControlloWin = "NON ESISTE" $bUtenteTrovato = True ExitLoop Else $iLinea+=1 If($sDatiUtente = "" And $bUtenteTrovato = False) Then MsgBox($MB_ICONWARNING, "Attenzione!", "Username o Password errati.") ExitLoop EndIf EndIf Until $bUtenteTrovato = True EndIf If($sControlloWin = "ESISTE") Then MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) GUICtrlSetState($button_VisualizzaGiacenze, $GUI_ENABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_ENABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_ENABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_ENABLE) GUICtrlSetState($button_CreaDDT, $GUI_ENABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_ENABLE) GUICtrlSetState($combo_Magazzino, $GUI_ENABLE) GUICtrlSetState($button_Logout, $GUI_ENABLE) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) Else MsgBox($MB_ICONINFORMATION, "", "La GUI non esiste!") MsgBox($MB_ICONINFORMATION, "Login effettuato!", "Hai effettuato l'accesso come: " & @CRLF & $sUsername & ".") ; Mostra la GUI Principale GUISetState(@SW_SHOW, $form_GestioneMagazzino) ; Setta come "non-cliccabile" il bottone di Login GUICtrlSetState($button_Login, $GUI_DISABLE) ; Setta l'utente che ha effettuato l'accesso nella label $label_CaptionUtente GUICtrlSetData($label_CaptionUtente, $sUsername) ; "Distruggi" la GUI Login GUIDelete($form_Login) FileClose($hFileUtenti) EndIf EndIf EndIf EndFunc Func Logout() GUICtrlSetData($label_CaptionUtente, "") MsgBox($MB_ICONINFORMATION, "Logout effettuato!", "Effettua nuovamente il Login per utilizzare il programma.") ; Disabilita tutti i bottoni della GUI Principale GUICtrlSetState($button_VisualizzaGiacenze, $GUI_DISABLE) GUICtrlSetState($button_AggiungiProdotto, $GUI_DISABLE) GUICtrlSetState($button_PrelevaProdotto, $GUI_DISABLE) GUICtrlSetState($button_RicercaProdotto, $GUI_DISABLE) GUICtrlSetState($button_CreaDDT, $GUI_DISABLE) GUICtrlSetState($button_MostraGiacenzeAZero, $GUI_DISABLE) GUICtrlSetState($combo_Magazzino, $GUI_DISABLE) GUICtrlSetState($button_Logout, $GUI_DISABLE) ; Abilita il Login GUICtrlSetState($button_Login, $GUI_ENABLE) EndFunc EDIT:
      Solved, making an "integrated" Login form...