Jump to content

Question about listview


lucio69f
 Share

Recommended Posts

there is also the fake mode :)

#include <Array.au3>

Local $sTxt = "Apple, Avocado, Apricot, Abiu, Blackberry, Bael, Cranberry, Cherry, Dates, Dragonfruit, Fig, Guava, Grapes, Grapefruit"

$aFruit = StringSplit($sTxt, ", ", $STR_ENTIRESPLIT + $STR_NOCOUNT)
_ArrayColInsert($aFruit, 1)
_ArrayColInsert($aFruit, 1)

For $i = 0 To UBound($aFruit) -1
    $aFruit[$i][1] = Random(0, 10000, 1)
    $aFruit[$i][2] = _fBar($aFruit[$i][1])
Next

_ArrayDisplay($aFruit)

;----------------------------------------------------------------------------------------
Func _fBar($iNumber, $iUnitCnt = 200)
    Local $sResult, $iCnt
    $iCnt = $iNumber / $iUnitCnt
    For $i = 1 To $iCnt
        $sResult &= "|"
    Next
    Return $sResult
EndFunc   ;==>_fBar

 

I know that I know nothing

Link to comment
Share on other sites

@lucio69f Alright, I must admit that the link I gave you was NOT the best I could give you.  So I made a minimalist example to show you how to display color easily in ListView:

#include <GUIConstants.au3>
#include <GuiListView.au3>

Global $hListView, $aColors[3][3]

_Example()

Func _Example()
  Local $hGUI = GUICreate("Colored ListView", 350, 250)
  Local $idListView = GUICtrlCreateListView("Number|Number|Number", 5, 5, 300, 150)
  $hListView = GUICtrlGetHandle($idListView)
  GUICtrlCreateListViewItem('1|1|1', $idListView)
  GUICtrlCreateListViewItem('2|2|2', $idListView)
  GUICtrlCreateListViewItem('3|3|3', $idListView)

  ; set background colors
  $aColors[0][1] = 0xFFAAFF
  $aColors[1][2] = 0x00AA00
  $aColors[2][0] = 0xCCCCCC

  GUIRegisterMsg($WM_NOTIFY, WM_NOTIFY)
  GUISetState()

  While True
    Switch GUIGetMsg()
      Case $GUI_EVENT_CLOSE
        Exit
    EndSwitch
  WEnd

EndFunc   ;==>_Example

Func WM_NOTIFY($hWnd, $Msg, $wParam, $lParam)
  Local $tNMHDR = DllStructCreate($tagNMHDR, $lParam)
  Switch $tNMHDR.hWndFrom
    Case $hListView
      Switch $tNMHDR.Code
        Case $NM_CUSTOMDRAW
          Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $lParam)
          Local $iDrawStage = $tCustDraw.dwDrawStage
          If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW
          If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW
          Local $iSubItem = $tCustDraw.iSubItem
          Local $iItem = $tCustDraw.dwItemSpec
          If $aColors[$iItem][$iSubItem] Then
            $tCustDraw.clrTextBk = $aColors[$iItem][$iSubItem]
          Else
            $tCustDraw.clrTextBk = 0xFFFFFF
          EndIf
          Return $CDRF_NEWFONT
      EndSwitch
  EndSwitch
  Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Hope that helps a bit more.  MSDN has all the info that you need to understand the process of owner drawing a list view.

Edited by Nine
clean up code
Link to comment
Share on other sites

I think there is a UDF for ListViews made by Melba (use the search feature of the forum) but I'm not sure how much can be customized. Anyway it's a good start.

Edit: here is the link

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

wooooooooow  

When I see these UDFs, I really feel stupid. Congratulations, he's truly a great programmer. I wouldn't even get there in a million years, I suppose. Do you think it's possible, through this UDF, to have a kind of colored histogram in the ListView and make a cell clickable with one command, and the cell next to it clickable with another command?

Link to comment
Share on other sites

1 hour ago, Andreik said:

By default I don't think it has all the features that you need but you can try to understand the logic and customize some functions to achieve your goal.

woow  you belive  in me  so much  , i love  you , but  i am very  bad  programmer  :D  but  thanks 

Link to comment
Share on other sites

8 hours ago, Andreik said:

I think @jchd patented (at least on the forum) the expression "threads are evil"

I'm only the messenger : https://www2.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

18 hours ago, argumentum said:

You can IPC between scripts. Try the Fork UDFish thing I put together. It may be useful to you.
( I am a copy'n'paste programmer if possible ) 

Nice i  will study  for the moment i use  a thread of  this https://github.com/jesobreira/authread  ,    the  first i find :D  but  sure i look your

9 hours ago, jchd said:

thanks  for this paper i read soon,but sometimes it is undeniable that threads are needed :D

18 hours ago, Andreik said:

I think @jchd patented (at least on the forum) the expression "threads are evil" and this is true in most cases. So I doubt it's as easy as you say but good luck. :yes:

i assure  is  easy , obviously for my simple project :D 

Link to comment
Share on other sites

1 hour ago, lucio69f said:

I looked at the code and is forking with an INI file as the IPC that's read every 250 ms.
Awful code. Don't believe a claim unless you concur.  The only thread in that code is the name.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Link to comment
Share on other sites

 

2 hours ago, argumentum said:

I looked at the code and is forking with an INI file as the IPC that's read every 250 ms.
Awful code. Don't believe a claim unless you concur.  The only thread in that code is the name.

thanks  i just started  with this UDF i try for the momenti with  this  but  after  read  your UDF  if  is  easy  , to use  i could  switch , thanks again

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...