Jump to content

Recommended Posts

@rasim / MrCreatoR,

This is a very nice concept your are showing both.

Interesting to see how both of you are challenging each other. :P

I have got an other challenging question.

Could this concept be used to add other controls to a listView ?

Like for instance adding Hyperlinks to the rows in a certain column. Since a Listview does not support anything else but plain text.

This is an example of a Hyperlink / Email control control

(Thanks to ProgAndy)

Syslink - Hypelink Control and

Syslink - Email Control

#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global Const $WC_LINK = "SysLink"
Global Const $WC_LINKA = $WC_LINK
Global Const $WC_LINKW = $WC_LINK

$Parent = GUICreate("SysLink demo")

$g_hLink = _WinAPI_CreateWindowEx(0,$WC_LINK, _ 
        'For more information, <A HREF="http://www.microsoft.com" ID="LInkIDURL+ID">click here</A> or ' & _
                                '<A href="http://www.microsoft.com">here</a> or ' & _
                                '<A href="mailto:xxx.yyyy@mycompany.com&subject=Syslink Demo&body=%0A%0AFrom AutoIT%0A%0A&cc=cc@address.com&bcc=bcc@address.com">E-mail Me</a> or, ' & _
                                '<A ID="idInfo">here</A>. And at last <a>here</a>', _
        BitOR($WS_VISIBLE , $WS_CHILD , $WS_TABSTOP), _
        10,10, 350,60, $Parent)
GUICtrlCreateButton("hi",10,80,80,30)
GUISetState()
GUIRegisterMsg($WM_NOTIFY,"MY_LINK_NOTIFY")


While GUIGetMsg() <> -3
    Sleep(1)
WEnd
        
;~ // g_hLink is the handle of the SysLink control.
Func MY_LINK_NOTIFY($hWnd, $Msg, $wParam, $lParam)
    Local Const $tagNMLINK = $tagNMHDR & ";" & "UINT mask; int iLink; UINT state; UINT stateMask; WCHAR szID[48]; WCHAR szUrl[2083];"
    Local $NMHDR = DllStructCreate($tagNMHDR,$lParam)
    Local $hwndFrom = DllStructGetData($NMHDR,"hwndFrom");
    Switch $hwndFrom
        Case $g_hLink
        switch DllStructGetData($NMHDR,"code")
            case $NM_CLICK
                ContinueCase
            case $NM_RETURN
                $NMHDR = DllStructCreate($tagNMLINK,$lParam)
                Local $iLink = DllStructGetData($NMHDR,"iLink")
                Local $szURL = DllStructGetData($NMHDR,"szURL")
                Local $szID = DllStructGetData($NMHDR,"szID")
                
                if $szURL <> "" Then
                    Local $ShouldOpen = MsgBox(4, 'Open URL?',"Should the URL be opened? "& @CRLF & $szURL & _
                        @CRLF & "If available, the Next Line Contains szID:" &@CRLF & $szID )
                    If $ShouldOpen = 6 Then ShellExecute($szURL, "", "", "open",@SW_SHOW);
                ElseIf $szID <> "" Then
                    MsgBox(0, 'Link Clicked',"The Link has no URL, but the following szID: " & @CRLF & $szID)
                Else
                    MsgBox(0, 'Link Clicked',"The Link has no URL, and no szID: " & @CRLF & $szID)
                EndIf
        EndSwitch
    EndSwitch
EndFunc

Would there be a way of combining this in your UDF ?

An other method would be to create an Custum Drawn ListView control. But that seem far more complex ?!

Thanks for sharing this so far.

Regards,

ptrex

Link to post
Share on other sites
  • Replies 49
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

See next post:

if you resize the window vertically smaller to show the vertical scrollbar, then scroll down, the progress bars are drawn on top of the column headers at the tops of the listviews.

After yesterday's beer my head bursts :P Fixed.

And this is not all, there is few more bugs :( (sorry, have no time right now to point them out).

Ok, I wait.

ptrex

Could this concept be used to add other controls to a listView ?

Hi! Your question very interesting. I try to realize this later :idea:
Link to post
Share on other sites

Could this concept be used to add other controls to a listView ?

Yes!

I posted ListView_SysLink UDF as new Topic. Please check it out. And thanks for the idea! :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 post
Share on other sites

Great Great Great Concept !!!

I've created a Treeview like listview, i mean - it has (+) which opens subtimes for each entry in the listview [like treeview] but it's too much of a costume made so i can't provide a UDF for it...

Just... another idea for ya :P

[u]My Au3 Scripts:[/u]____________(E)Lephant, A Share download manager (RS/MU etc)Http1.1 Console, The Ez Way!Internet Reconnection Automation Suite & A Macro Recording Tool.SK's Alarm Clock, Playing '.MP3 & .Wav' Files._________________Is GOD a mistake of the Humanity Or the Humanity is a mistake of GOD ?!

Link to post
Share on other sites
  • 3 months later...
  • 1 year later...

Hmm.. it's a bummer if you use groups

If you read the UDF of guilistview.au3 you will see, most things return to _GUICtrlListView_SetItemEx($hWnd, ByRef $tItem)

So I think I have to make a $tagLVITEM structure, I don't know how, but I will respond to you all, when I have it:P

Edit: hmm... oke, can't, but then I have to make 100 images:'), hope this wouldn't make it slow:')

Edited by Gideon

Many times you need to think like hobby-bob:')

Link to post
Share on other sites
  • 7 months later...
  • 3 years later...

I like this UDF, but what about using it with Ownerdraw. I don't get it work. Have someone the ability to implement the feature???

Look at my attachments, tt can directly be used. Try to comment out GUIRegisterMsg($WM_DRAWITEM, "WM_DRAWITEM") and you will se how smooth it works and then activate it again. The ListView is not drawed properly anymore.

Example.au3

ListView_Progress_ohneProc.au3

Edited by Trolleule
Link to post
Share on other sites

I have just seen this UDF. Nice.

Trolleule, I don't know if owner drawn (WM_DRAWITEM) listview items is a good idea. The main problem is that you end up in a situation, where you are executing too much code. I've quickly looked through your code. Especially the for loop you use to handle the columns is spending a lot of time. Since there is already code to update the progressbars, you should not add too much extra code.

If you need colors, you're probably better helped by using NM_CUSTOMDRAW notifications. This seems to be easier to implement with a smaller amount of code. And you don't need to implement for loops for the columns yourself. Take a look at this example. But I don't know how good it'll work with progressbars.

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...