Jump to content

Recommended Posts

Posted (edited)

Hello i hope someone can help me with my problem.

What i'm trying to do is having a listview with both icons and text but this is what i get:

Posted Image

Where i would really like to get this: (Image edited with gimp)

Posted Image

I'm sure it's just a style i have to apply to get it working but i couldn't find it.

Here's my code for the first picture:

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>


_Main()

Func _Main()
Local $hImage, $aSize, $listview

GUICreate("ImageList Set Icon Size", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 296, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $LVS_NOCOLUMNHEADER))
GUISetState()

$hImage = _GUIImageList_Create(64, 64, 5, 4, 3)
_GUIImageList_AddIcon($hImage, @SystemDir & "shell32.dll", 110, True)
_GUIImageList_AddIcon($hImage, @SystemDir & "shell32.dll", 131, True)
_GUIImageList_AddIcon($hImage, @SystemDir & "shell32.dll", 165, True)
_GUICtrlListView_SetImageList($listview, $hImage, 1)

; Add columns
_GUICtrlListView_AddColumn($listview, "", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Icon 1", 0)
_GUICtrlListView_AddItem($listview, "Icon 2", 1)
_GUICtrlListView_AddItem($listview, "Icon 3", 2)

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

Half of the code is from the helpfile.

Sorry for any bad English there may be I'm from Denmark and only 13 years old. :-)

EDIT: Fixed Pictures

Edited by playjacob
Posted

Hi,

The only function I know to change the display style of a listview is _GUICtrlListView_SetView but It does not do what you want. Maybe you have to edit some styles of your listview.

Br, FireFox.

Posted

Hi,

The only function I know to change the display style of a listview is _GUICtrlListView_SetView but It does not do what you want. Maybe you have to edit some styles of your listview.

Br, FireFox.

I think that editing some styles would be the way to go, but witch?

Is there any where that you can see all the style that you can use on a listview?

Posted

What about this >>

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

What about this >>

That might be what i want but i can't seem to get images to work when you use "_GUICtrlListView_SetView($hListView, 4)" to set the listview to tile mode.

Posted

I haven't had much success either, but then I haven't done much research on it. Sorry.

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Tiles have the text to the right, I thought that wasn't what you wanted? Images are fine, but you must change _GUICtrlListView_SetImageList() to 0 (large images).

Large icons (SetView 1) is more like your picture but horizontal.

_GUICtrlListView_SetView($listview, 1)
_GUICtrlListView_SetImageList($listview, $hImage, 0)
Posted

Tiles have the text to the right, I thought that wasn't what you wanted? Images are fine, but you must change _GUICtrlListView_SetImageList() to 0 (large images).

Large icons (SetView 1) is more like your picture but horizontal.

_GUICtrlListView_SetView($listview, 1)
_GUICtrlListView_SetImageList($listview, $hImage, 0)
Ah, large icons!

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

I've never learned which size goes where, I just try them all. Luckily there is only three! :idiot::D

The old trial and error method!

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Posted

Tiles have the text to the right, I thought that wasn't what you wanted? Images are fine, but you must change _GUICtrlListView_SetImageList() to 0 (large images).

Large icons (SetView 1) is more like your picture but horizontal.

_GUICtrlListView_SetView($listview, 1)
_GUICtrlListView_SetImageList($listview, $hImage, 0)

Damn... I though he already tried it.
Posted (edited)

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

_Main()

Func _Main()
Local $hImage, $aSize, $listview

$hGUI = GUICreate("LV", 400, 300)
$listview = GUICtrlCreateListView("", 2, 2, 394, 296, BitOR($LVS_ICON, $LVS_ALIGNLEFT))
_GUICtrlListView_SetView($listview, 1)
; _GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_HIDELABELS) ; nice one too :)...

$hImage_Large = _GUIImageList_Create(32, 32, 5, 4, 3)
_GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 110, True)
_GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 131, True)
_GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 165, True)

_GUICtrlListView_SetImageList($listview, $hImage_Large, 0)

; Add columns
_GUICtrlListView_AddColumn($listview, "", 120)

; Add items
_GUICtrlListView_AddItem($listview, "Icon 1", 0)
_GUICtrlListView_AddItem($listview, "Icon 2", 1)
_GUICtrlListView_AddItem($listview, "Icon 3", 2)

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

_GUIImageList_Destroy($hImage_Large)

GUIDelete()
EndFunc ;==>_Main

Edit:

Additionally you can fine-tune the layout with _GUICtrlListView_SetIconSpacing().

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>

_Main2()

Func _Main2()
    Local $hImage, $aSize, $listview

    $hGUI = GUICreate("LV", 400, 300)
    $listview = GUICtrlCreateListView("", 2, 2, 394, 296, BitOR($LVS_ICON, $LVS_ALIGNLEFT))
    _GUICtrlListView_SetView($listview, 1)
    ;_GUICtrlListView_SetExtendedListViewStyle($listview, $LVS_EX_HIDELABELS) ; nice one too :)...

    $hImage_Large = _GUIImageList_Create(32, 32, 5, 4, 3)
    _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 110, True)
    _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 131, True)
    _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 165, True)

    _GUICtrlListView_SetImageList($listview, $hImage_Large, 0)
    _GUICtrlListView_SetIconSpacing($listview, 32 + 6, 26)

    ; Add columns
    _GUICtrlListView_AddColumn($listview, "", 120)

    ; Add items

    For $y = 1 To 7
        For $i = 0 To 2
            _GUICtrlListView_AddItem($listview, "Icon " & $y * ($i + 1), $i)
        Next
    Next

    GUISetState()

    Do
    Until GUIGetMsg() = $GUI_EVENT_CLOSE

    _GUIImageList_Destroy($hImage_Large)

    GUIDelete()
EndFunc   ;==>_Main2
Edited by KaFu
Posted (edited)

So $LVS_ALIGNLEFT is how you do it. Nice one. I see it's in the helpfile for _GUICtrlListView_Create() but not GUICtrlCreateListView(), I don't like it when they do like that.

Edited by AdmiralAlkex
Posted (edited)

Edit:

Additionally you can fine-tune the layout with _GUICtrlListView_SetIconSpacing().

Thanks! That's just what i wanted. :ILA2:

EDIT: I'm now having another problem the listview make several row horizontally and i only want it to be a one vertical line of icons in a listview.

I've messed around with the _GUICtrlListView_SetIconSpacing but that didn't seam to do the trick. Any way to do that?

Edited by playjacob
Posted

I'm not sure if this is the proper way :lol:, but if not it's at least a work-around. You can define a tight workarea to prevent a "column break" with _GUICtrlListView_SetWorkAreas().

#include <GUIConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
_Main2()
Func _Main2()
 Local $hImage, $aSize, $hListview
 $hGUI = GUICreate("LV", 400, 300)
 $cListview = GUICtrlCreateListView("", 2, 2, 394, 296, BitOR($LVS_ICON, $LVS_ALIGNLEFT))
 $hListview = GUICtrlGetHandle($cListview)
 _GUICtrlListView_SetView($hListview, 1)
 ;_GUICtrlListView_SetExtendedListViewStyle($hListview, $LVS_EX_HIDELABELS) ; nice one too :)...
 $hImage_Large = _GUIImageList_Create(32, 32, 5, 4, 3)
 _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 110, True)
 _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 131, True)
 _GUIImageList_AddIcon($hImage_Large, @SystemDir & "shell32.dll", 165, True)
 _GUICtrlListView_SetImageList($hListview, $hImage_Large, 0)
 _GUICtrlListView_SetIconSpacing($hListview, 32 + 6, 26)
 ; Add columns
 _GUICtrlListView_AddColumn($hListview, "", 120)
 ; Add items
 For $y = 1 To 21
  _GUICtrlListView_AddItem($hListview, "Icon " & $y, 1)
 Next
 _GUICtrlListView_SetWorkAreas($hListview, 0, 0, 32, $y * 3 * 32)
 GUISetState()
 Do
 Until GUIGetMsg() = $GUI_EVENT_CLOSE
 _GUIImageList_Destroy($hImage_Large)
 GUIDelete()
EndFunc   ;==>_Main2
Posted

I'm not sure if this is the proper way :lol:, but if not it's at least a work-around. You can define a tight workarea to prevent a "column break" with _GUICtrlListView_SetWorkAreas().

Thanks that seams to work as i wont it to.

Thanks to all that helped!

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