Sign in to follow this  
Followers 0
13lack13lade

Listview to show %

10 posts in this topic

Hi Guys,

I have a listview, hooked up to a excel workbook to display just like a table however, i am wanting percentages to show as percentages...

Is there a way to manually set the value to percentage?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I have tried just * 100 to get for example 82.55 which would be acceptable however it keeps the trailing numbers and doesnt show 82.55 even if thats how ive set it in excel it will show 82.5518273409164592734

 

Also is it possible to wrap the column headings of the listview?

And how can you increase the speed the listview is 'built' , takes a few seconds to load on my screen - is there anything i can do to assist in the loading?

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

I have tried just * 100 to get for example 82.55 which would be acceptable however it keeps the trailing numbers and doesnt show 82.55 even if thats how ive set it in excel it will show 82.5518273409164592734

Use the Round() function to limit it to however many digits you want after the decimal.

Also is it possible to wrap the column headings of the listview?

No

And how can you increase the speed the listview is 'built' , takes a few seconds to load on my screen - is there anything i can do to assist in the loading?

Use _GUICtrlListView_BeginUpdate before populating the listview, and _GUICtrlListView_EndUpdate after populating it.

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

#4 ·  Posted (edited)

round as in, in excel or autoit? if autoit, how would i enter that in? 

in regards to guictrllistview_beginupdate end update... i cant seem to get it to work correctly, runs then closes my program straight away and errors out... i think my listview may have been setup wrong... It works perfectly however just loads slow - tried adding the begin end updates it error'd "Variable being used without being declared" _GUICtrlListView_BeginUpdate($australia)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Excel.au3>
#include <Table.au3>
#include <File.au3>
#include <GUIListView.au3>




$oExcel1 = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "MainUpdateShell.xlsx", 0, True)
$mainupdate = _ExcelReadCell($oExcel1,1,1)
 _ExcelBookClose($oExcel1,0,0)


#Region ### START Koda GUI section ### Form=
$MainSreen = GUICreate("Flight Centre Global Product Dashboard", 1176, 756, 256, 99)
$Banner = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Images\banner.jpg", 0, 0, 1177, 137, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER))
$Trackingbtn = GUICtrlCreateButton("Tracking", 8, 296, 169, 49)
$Loadbtn = GUICtrlCreateButton("Load Guide", 8, 368, 169, 49)
$Quicklinksbtn = GUICtrlCreateButton("QuickLinks", 8, 440, 169, 49)
$Dataloadbtn = GUICtrlCreateButton("Dataload", 8, 512, 169, 49)
$Formsbtn = GUICtrlCreateButton("Forms", 8, 584, 169, 49)
$Graph = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\OverallChart.jpg", 688, 152, 481, 337)
$Logo = GUICtrlCreatePic("C:\Users\webbth\Pictures\Untitled1.jpg", 8, 152, 169, 121, BitOR($GUI_SS_DEFAULT_PIC,$WS_BORDER))
$Feedbackbtn = GUICtrlCreateButton("Dashboard Feedback", 8, 656, 169, 49)
$Clipboard = GUICtrlCreateButton("Copy table to clipboard", 192, 712, 977, 17)
;~ $MainData = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\myfile.jpg", 192, 504, 977, 209,$WS_BORDER)
$Label1 = GUICtrlCreateLabel($mainupdate, 192, 152, 484, 340, $WS_BORDER)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$MainLogo = GUICtrlCreateLabel("FCGP Dashboard", 400, 40, 420, 79)
GUICtrlSetFont(-1, 48, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(Default, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

;overall listview array
$oExcel = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "graphdata.xlsm" , 0 , True)
$l1c1 = _ExcelReadCell($oExcel,2,1)
$l1c2 = _ExcelReadCell($oExcel,2,2)
$l1c3 = _ExcelReadCell($oExcel,2,3)
$l1c4 = _ExcelReadCell($oExcel,2,4)
$l1c5 = _ExcelReadCell($oExcel,19,5)
$l1c6 = _ExcelReadCell($oExcel,2,6)
$l1c7 = _ExcelReadCell($oExcel,2,7)
$l1c8 = _ExcelReadCell($oExcel,2,8)
$l1c9 = _ExcelReadCell($oExcel,2,9) 
$l1c10 = _ExcelReadCell($oExcel,2,10)
$l1c11 = _ExcelReadCell($oExcel,2,11)
$l1c12 = _ExcelReadCell($oExcel,2,12)
$l1c13 = _ExcelReadCell($oExcel,2,13)
$l1c14 = _ExcelReadCell($oExcel,2,14)
$l1c15 = _ExcelReadCell($oExcel,2,15)
$l1c16 = _ExcelReadCell($oExcel,2,16)
$l1c17 = _ExcelReadCell($oExcel,2,17)
$l1c18 = _ExcelReadCell($oExcel,2,18)
$l1c19 = _ExcelReadCell($oExcel,2,19)
$l1c20 = _ExcelReadCell($oExcel,2,20)
;australia listview array
$l2c1 = _ExcelReadCell($oExcel,5,1)
$l2c2 = _ExcelReadCell($oExcel,5,2)
$l2c3 = _ExcelReadCell($oExcel,5,3)
$l2c4 = _ExcelReadCell($oExcel,5,4)
$l2c5 = _ExcelReadCell($oExcel,5,5)
$l2c6 = _ExcelReadCell($oExcel,5,6)
$l2c7 = _ExcelReadCell($oExcel,5,7)
$l2c8 = _ExcelReadCell($oExcel,5,8)
$l2c9 = _ExcelReadCell($oExcel,5,9) 
$l2c10 = _ExcelReadCell($oExcel,5,10)
$l2c11 = _ExcelReadCell($oExcel,5,11)
$l2c12 = _ExcelReadCell($oExcel,5,12)
$l2c13 = _ExcelReadCell($oExcel,5,13)
$l2c14 = _ExcelReadCell($oExcel,5,14)
$l2c15 = _ExcelReadCell($oExcel,5,15)
$l2c16 = _ExcelReadCell($oExcel,5,16)
$l2c17 = _ExcelReadCell($oExcel,5,17)
$l2c18 = _ExcelReadCell($oExcel,5,18)
$l2c19 = _ExcelReadCell($oExcel,5,19)
$l2c20 = _ExcelReadCell($oExcel,5,20)
;southpac listview array
$l3c1 = _ExcelReadCell($oExcel,8,1)
$l3c2 = _ExcelReadCell($oExcel,8,2)
$l3c3 = _ExcelReadCell($oExcel,8,3)
$l3c4 = _ExcelReadCell($oExcel,8,4)
$l3c5 = _ExcelReadCell($oExcel,8,5)
$l3c6 = _ExcelReadCell($oExcel,8,6)
$l3c7 = _ExcelReadCell($oExcel,8,7)
$l3c8 = _ExcelReadCell($oExcel,8,8)
$l3c9 = _ExcelReadCell($oExcel,8,9) 
$l3c10 = _ExcelReadCell($oExcel,8,10)
$l3c11 = _ExcelReadCell($oExcel,8,11)
$l3c12 = _ExcelReadCell($oExcel,8,12)
$l3c13 = _ExcelReadCell($oExcel,8,13)
$l3c14 = _ExcelReadCell($oExcel,8,14)
$l3c15 = _ExcelReadCell($oExcel,8,15)
$l3c16 = _ExcelReadCell($oExcel,8,16)
$l3c17 = _ExcelReadCell($oExcel,8,17)
$l3c18 = _ExcelReadCell($oExcel,8,18)
$l3c19 = _ExcelReadCell($oExcel,8,19)
$l3c20 = _ExcelReadCell($oExcel,8,20)
;asia listview array
$l4c1 = _ExcelReadCell($oExcel,11,1)
$l4c2 = _ExcelReadCell($oExcel,11,2)
$l4c3 = _ExcelReadCell($oExcel,11,3)
$l4c4 = _ExcelReadCell($oExcel,11,4)
$l4c5 = _ExcelReadCell($oExcel,11,5)
$l4c6 = _ExcelReadCell($oExcel,11,6)
$l4c7 = _ExcelReadCell($oExcel,11,7)
$l4c8 = _ExcelReadCell($oExcel,11,8)
$l4c9 = _ExcelReadCell($oExcel,11,9) 
$l4c10 = _ExcelReadCell($oExcel,11,10)
$l4c11 = _ExcelReadCell($oExcel,11,11)
$l4c12 = _ExcelReadCell($oExcel,11,12)
$l4c13 = _ExcelReadCell($oExcel,11,13)
$l4c14 = _ExcelReadCell($oExcel,11,14)
$l4c15 = _ExcelReadCell($oExcel,11,15)
$l4c16 = _ExcelReadCell($oExcel,11,16)
$l4c17 = _ExcelReadCell($oExcel,11,17)
$l4c18 = _ExcelReadCell($oExcel,11,18)
$l4c19 = _ExcelReadCell($oExcel,11,19)
$l4c20 = _ExcelReadCell($oExcel,11,20)
;asia listview array
$l5c1 = _ExcelReadCell($oExcel,14,1)
$l5c2 = _ExcelReadCell($oExcel,14,2)
$l5c3 = _ExcelReadCell($oExcel,14,3)
$l5c4 = _ExcelReadCell($oExcel,14,4)
$l5c5 = _ExcelReadCell($oExcel,14,5)
$l5c6 = _ExcelReadCell($oExcel,14,6)
$l5c7 = _ExcelReadCell($oExcel,14,7)
$l5c8 = _ExcelReadCell($oExcel,14,8)
$l5c9 = _ExcelReadCell($oExcel,14,9) 
$l5c10 = _ExcelReadCell($oExcel,14,10)
$l5c11 = _ExcelReadCell($oExcel,14,11)
$l5c12 = _ExcelReadCell($oExcel,14,12)
$l5c13 = _ExcelReadCell($oExcel,14,13)
$l5c14 = _ExcelReadCell($oExcel,14,14)
$l5c15 = _ExcelReadCell($oExcel,14,15)
$l5c16 = _ExcelReadCell($oExcel,14,16)
$l5c17 = _ExcelReadCell($oExcel,14,17)
$l5c18 = _ExcelReadCell($oExcel,14,18)
$l5c19 = _ExcelReadCell($oExcel,14,19)
$l5c20 = _ExcelReadCell($oExcel,14,20)
;africa listview array
$l6c1 = _ExcelReadCell($oExcel,17,1)
$l6c2 = _ExcelReadCell($oExcel,17,2)
$l6c3 = _ExcelReadCell($oExcel,17,3)
$l6c4 = _ExcelReadCell($oExcel,17,4)
$l6c5 = _ExcelReadCell($oExcel,17,5)
$l6c6 = _ExcelReadCell($oExcel,17,6)
$l6c7 = _ExcelReadCell($oExcel,17,7)
$l6c8 = _ExcelReadCell($oExcel,17,8)
$l6c9 = _ExcelReadCell($oExcel,17,9) 
$l6c10 = _ExcelReadCell($oExcel,17,10)
$l6c11 = _ExcelReadCell($oExcel,17,11)
$l6c12 = _ExcelReadCell($oExcel,17,12)
$l6c13 = _ExcelReadCell($oExcel,17,13)
$l6c14 = _ExcelReadCell($oExcel,17,14)
$l6c15 = _ExcelReadCell($oExcel,17,15)
$l6c16 = _ExcelReadCell($oExcel,17,16)
$l6c17 = _ExcelReadCell($oExcel,17,17)
$l6c18 = _ExcelReadCell($oExcel,17,18)
$l6c19 = _ExcelReadCell($oExcel,17,19)
$l6c20 = _ExcelReadCell($oExcel,17,20)
 _ExcelBookClose($oExcel,0,0)
    
_GUICtrlListView_BeginUpdate($ListView)
_GUICtrlListView_BeginUpdate($Overall)
_GUICtrlListView_BeginUpdate($Australia)
_GUICtrlListView_BeginUpdate($Southpac)
_GUICtrlListView_BeginUpdate($Asia)
_GUICtrlListView_BeginUpdate($Europe)
_GUICtrlListView_BeginUpdate($Africa)
    $listview = GUICtrlCreateListView("Destinations Summary|Suppliers|Contracts Sent|Contracts Recieved|%|Ready to Load Inhouse|%|Ready to Load TT|%|Ready to Load Total|%|Loaded Inhouse|%|Loaded TT|%|Total Loaded|%|Total Priced Out|%|Product Codes", 192, 504, 977, 209,$WS_BORDER);,$LVS_SORTDESCENDING)
    $Overall = GUICtrlCreateListViewItem($l1c1&"|"&$l1c2&"|"&$l1c3&"|"&$l1c4&"|"&$l1c5&"|"&$l1c6&"|"&$l1c7&"|"&$l1c8&"|"&$l1c9&"|"&$l1c10&"|"&$l1c11&"|"&$l1c12&"|"&$l1c13&"|"&$l1c14&"|"&$l1c15&"|"&$l1c16&"|"&$l1c17&"|"&$l1c18&"|"&$l1c19&"|"&$l1c20, $listview)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
    GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
$Australia = GUICtrlCreateListViewItem($l2c1&"|"&$l2c2&"|"&$l2c3&"|"&$l2c4&"|"&$l2c5&"|"&$l2c6&"|"&$l2c7&"|"&$l2c8&"|"&$l2c9&"|"&$l2c10&"|"&$l2c11&"|"&$l2c12&"|"&$l2c13&"|"&$l2c14&"|"&$l2c15&"|"&$l2c16&"|"&$l2c17&"|"&$l2c18&"|"&$l2c19&"|"&$l2c20, $listview)
    GUICtrlSetBkColor(-1,0x004E98)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
    $Southpac = GUICtrlCreateListViewItem($l3c1&"|"&$l3c2&"|"&$l3c3&"|"&$l3c4&"|"&$l3c5&"|"&$l3c6&"|"&$l3c7&"|"&$l3c8&"|"&$l3c9&"|"&$l3c10&"|"&$l3c11&"|"&$l3c12&"|"&$l3c13&"|"&$l3c14&"|"&$l3c15&"|"&$l3c16&"|"&$l3c17&"|"&$l3c18&"|"&$l3c19&"|"&$l3c20, $listview)
  GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
    GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1,0x004E98)
$Asia = GUICtrlCreateListViewItem($l4c1&"|"&$l4c2&"|"&$l4c3&"|"&$l4c4&"|"&$l4c5&"|"&$l4c6&"|"&$l4c7&"|"&$l4c8&"|"&$l4c9&"|"&$l4c10&"|"&$l4c11&"|"&$l4c12&"|"&$l4c13&"|"&$l4c14&"|"&$l4c15&"|"&$l4c16&"|"&$l4c17&"|"&$l4c18&"|"&$l4c19&"|"&$l4c20, $listview)
  GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
    GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1,0x004E98)
$Europe = GUICtrlCreateListViewItem($l5c1&"|"&$l5c2&"|"&$l5c3&"|"&$l5c4&"|"&$l5c5&"|"&$l5c6&"|"&$l5c7&"|"&$l5c8&"|"&$l5c9&"|"&$l5c10&"|"&$l5c11&"|"&$l5c12&"|"&$l5c13&"|"&$l5c14&"|"&$l5c15&"|"&$l5c16&"|"&$l5c17&"|"&$l5c18&"|"&$l5c19&"|"&$l5c20, $listview)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
    GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1,0x004E98)
$Africa = GUICtrlCreateListViewItem($l6c1&"|"&$l6c2&"|"&$l6c3&"|"&$l6c4&"|"&$l6c5&"|"&$l6c6&"|"&$l6c7&"|"&$l6c8&"|"&$l6c9&"|"&$l6c10&"|"&$l6c11&"|"&$l6c12&"|"&$l6c13&"|"&$l6c14&"|"&$l6c15&"|"&$l6c16&"|"&$l6c17&"|"&$l6c18&"|"&$l6c19&"|"&$l6c20, $listview)
    GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
    GUICtrlSetColor(-1, 0xFFFFFF)
    GUICtrlSetBkColor(-1,0x004E98)
_GUICtrlListView_EndUpdate($ListView)
_GUICtrlListView_EndUpdate($Overall)
_GUICtrlListView_EndUpdate($Australia)
_GUICtrlListView_EndUpdate($Southpac)
_GUICtrlListView_EndUpdate($Asia)
_GUICtrlListView_EndUpdate($Europe)
_GUICtrlListView_EndUpdate($Africa)




While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case $clipboard
Clipput($listview,$overall,$australia,$southpac,$asia,$europe,$africa)


EndSwitch
WEnd

Also - I am wanting to copy the entire listview to clipboard at the click of a button (you can see at the end of script) however doesnt work, not too sure what im doing incorrectly... if someone can advise that would be great!

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

I hope you realize none of your "arrays" are actually arrays? Try this change to your script, it makes it far less repetitive and MUCH easier to modify as needed.

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Excel.au3>
#include <Table.au3>
#include <File.au3>
#include <GUIListView.au3>




$oExcel1 = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "MainUpdateShell.xlsx", 0, True)
$mainupdate = _ExcelReadCell($oExcel1, 1, 1)
_ExcelBookClose($oExcel1, 0, 0)


#region ### START Koda GUI section ### Form=
$MainSreen = GUICreate("Flight Centre Global Product Dashboard", 1176, 756, 256, 99)
$Banner = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Images\banner.jpg", 0, 0, 1177, 137, BitOR($GUI_SS_DEFAULT_PIC, $WS_BORDER))
$Trackingbtn = GUICtrlCreateButton("Tracking", 8, 296, 169, 49)
$Loadbtn = GUICtrlCreateButton("Load Guide", 8, 368, 169, 49)
$Quicklinksbtn = GUICtrlCreateButton("QuickLinks", 8, 440, 169, 49)
$Dataloadbtn = GUICtrlCreateButton("Dataload", 8, 512, 169, 49)
$Formsbtn = GUICtrlCreateButton("Forms", 8, 584, 169, 49)
$Graph = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\OverallChart.jpg", 688, 152, 481, 337)
$Logo = GUICtrlCreatePic("C:\Users\webbth\Pictures\Untitled1.jpg", 8, 152, 169, 121, BitOR($GUI_SS_DEFAULT_PIC, $WS_BORDER))
$Feedbackbtn = GUICtrlCreateButton("Dashboard Feedback", 8, 656, 169, 49)
$Clipboard = GUICtrlCreateButton("Copy table to clipboard", 192, 712, 977, 17)
;~ $MainData = GUICtrlCreatePic("Q:\Documents\Load Support\Tom\Projects\Dashboard\Charts\myfile.jpg", 192, 504, 977, 209,$WS_BORDER)
$Label1 = GUICtrlCreateLabel($mainupdate, 192, 152, 484, 340, $WS_BORDER)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xFFFFFF)
$MainLogo = GUICtrlCreateLabel("FCGP Dashboard", 400, 40, 420, 79)
GUICtrlSetFont(-1, 48, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(Default, $GUI_BKCOLOR_TRANSPARENT)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

;overall listview array
$oExcel = _ExcelBookOpen("Q:\Documents\Load Support\Tom\Projects\Dashboard\" & "graphdata.xlsm", 0, True)
Global $l1c1 = ""
For $i = 1 To 19
    $l1c1 &= _ExcelReadCell($oExcel, 2, $i) & "|"
Next
$l1c1 &= _ExcelReadCell($oExcel, 2, 20)
;australia listview array
Global $l2c1 = ""
For $i = 1 To 19
    $l2c1 &= _ExcelReadCell($oExcel, 5, $i) & "|"
Next
$l2c1 &= _ExcelReadCell($oExcel, 5, 20)
;southpac listview array
Global $l3c1 = ""
For $i = 1 To 19
    $l3c1 &= _ExcelReadCell($oExcel, 8, $i) & "|"
Next
$l3c1 &= _ExcelReadCell($oExcel, 8, 20)
;asia listview array
Global $l4c1 = ""
For $i = 1 To 19
    $l4c1 &= _ExcelReadCell($oExcel, 11, $i) & "|"
Next
$l4c1 &= _ExcelReadCell($oExcel, 11, 20)
;asia listview array
Global $l5c1 = ""
For $i = 1 To 19
    $l5c1 &= _ExcelReadCell($oExcel, 14, $i) & "|"
Next
$l5c1 &= _ExcelReadCell($oExcel, 14, 20)
;africa listview array
Global $l6c1 = ""
For $i = 1 To 19
    $l6c1 &= _ExcelReadCell($oExcel, 17, $i) & "|"
Next
$l6c1 &= _ExcelReadCell($oExcel, 17, 20)
_ExcelBookClose($oExcel, 0, 0)

$listview = GUICtrlCreateListView("Destinations Summary|Suppliers|Contracts Sent|Contracts Recieved|%|Ready to Load Inhouse|%|Ready to Load TT|%|Ready to Load Total|%|Loaded Inhouse|%|Loaded TT|%|Total Loaded|%|Total Priced Out|%|Product Codes", 192, 504, 977, 209, $WS_BORDER);,$LVS_SORTDESCENDING)
_GUICtrlListView_BeginUpdate($listview)
$Overall = GUICtrlCreateListViewItem($l1c1, $listview)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x000080)
$Australia = GUICtrlCreateListViewItem($l2c1, $listview)
GUICtrlSetBkColor(-1, 0x004E98)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
$Southpac = GUICtrlCreateListViewItem($l3c1, $listview)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x004E98)
$Asia = GUICtrlCreateListViewItem($l4c1, $listview)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x004E98)
$Europe = GUICtrlCreateListViewItem($l5c1, $listview)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x004E98)
$Africa = GUICtrlCreateListViewItem($l6c1, $listview)
GUICtrlSetFont(-1, 10, 400, 0, "Arial Narrow")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x004E98)
_GUICtrlListView_EndUpdate($listview)




While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Clipboard
            ClipPut($listview, $Overall, $Australia, $Southpac, $Asia, $Europe, $Africa)


    EndSwitch
WEnd

I obviously can't test this as I don't have the images or the excel spreadsheet, but I am fairly certain it will populate the Listview correctly. 

BTW, you can't copy a listview's contents to the clipboard the way you're attempting to do it. And frankly you probably should be doing whatever it is you're doing with the ClipPut some other way.


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

#6 ·  Posted (edited)

Yeah i had a funny feeling i was doing it wrong as the examples i came across online were set out differently however it was working and i didnt know a better way of doing it (like above)

Alot less headache! thank you for that!

I was wanting to copy the entire data in the listview to clipboard thinking it would be quite simple however, it appears not lol

Round also worked, thanks!

Edited by 13lack13lade

Share this post


Link to post
Share on other sites

What format does the data need to be in the clipboard? Because your variables hold all the information that the listview contains, and you could probably use them to do whatever it is that you needed from the listview.


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

i was just wanting the entire list view copied to clipboard so they can paste it into excel if they want to calculate figures or something like that.. it isnt a necessity i just thought it would be a cool function to add.

i was wanting it in the same format as the listview, so in a table

Share this post


Link to post
Share on other sites

A listview isn't a table, it just displays information in a table like format.

I'd use the _Excel* functions to transfer the contents of the variables to Excel instead of trying to use the clipboard, it's much more reliable. Although I don't have any experience with the Excel UDF I'd recommend that first or the rewrite that Water is doing.


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

No worries, i will have abit of play however if its too complicated i just wont worry about it as they can simply access the spreadsheet to copy the figures off anyway

Thank you for your time BrewMan! muchly appreciated!

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