Jump to content

list view. Change only 1 cell,colum,line font color ect...


slaughter
 Share

Recommended Posts

Hi

At this moment i culdn't manage to find way how to change list view cell or colum properties.

Line change i managed to do

This for changing line

#include <GuiConstants.au3>

GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))

$List_1 = GUICtrlCreateListView("Name | Lastname", 30, 40, 200, 149)
$item1 = GUICtrlCreateListViewItem("1",$List_1)
GUICtrlSetColor(-1,0xFFFFFF)
$item2 = GUICtrlCreateListViewItem("2",$List_1)

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
   ;;;
    EndSelect
WEnd
Exit

Now we nead to make change on collum or single cell...

Lieke to make row: 1 col:1 font size 16 and row:1 col:2-3 stay default font size....

Pleas help me... because in A3L i dint fuond anyting.

#include <A3LImageList.au3>
#include <A3LListView.au3>

Global $hGUI, $hList, $hImage, $iLabel, $iIndex=-1, $iSubIndex=-1

; Create GUI
$hGUI   = GUICreate("ListView", 400, 300)
$hList  = _ListView_Create($hGUI, 2, 2, 394, 268)
$iLabel = GUICtrlCreateLabel("", 2, 278, 394, 20)

; Enable extended control styles
_ListView_SetExtendedListViewStyle($hList, $LVS_EX_SUBITEMIMAGES)
GUISetState()

; Load images
$hImage = _ImageList_Create()
_ImageList_Add($hImage, _Lib_CreateSolidBitmap($hList, 0xFF0000, 16, 16))
_ImageList_Add($hImage, _Lib_CreateSolidBitmap($hList, 0x00FF00, 16, 16))
_ImageList_Add($hImage, _Lib_CreateSolidBitmap($hList, 0x0000FF, 16, 16))
_ListView_SetImageList($hList, $hImage, 1)

; Add columns
_ListView_AddColumn($hList, "Column 1", 100)
_ListView_AddColumn($hList, "Column 2", 100)
_ListView_AddColumn($hList, "Column 3", 100)

; Add items
_ListView_AddItem   ($hList,    "Row 1: Col 1", 0)
_ListView_AddSubItem($hList, 0, "Row 1: Col 2", 1, 1)
_ListView_AddSubItem($hList, 0, "Row 1: Col 3", 2, 2)
_ListView_AddItem   ($hList,    "Row 2: Col 1", 1)
_ListView_AddSubItem($hList, 1, "Row 2: Col 2", 1, 2)
_ListView_AddItem   ($hList,    "Row 3: Col 1", 2)
_ListView_SetItem_properties($hList)
; Loop until user exits
while 1
  Switch GUIGetMsg()
    case $GUI_EVENT_PRIMARYDOWN
      DoHitTest()
    case $GUI_EVENT_CLOSE
      Exit
  EndSwitch
wend

Func DoHitTest()
  Local $aHit

  $aHit = _ListView_SubItemHitTest($hList)
  if ($aHit[0] <> -1) and (($aHit[0] <> $iIndex) or ($aHit[1] <> $iSubIndex)) then
    GUICtrlSetData($iLabel, StringFormat("HitTest Item: %d, SubItem: %d", $aHit[0], $aHit[1]))
    $iIndex = $aHit[0]
    $iSubIndex = $aHit[1]
  endif
EndFunc


; trying to mke func to change font or color, but usless :( I copied this from somewre
; and tryed to make it work for my purpose.... :/

Func _ListView_SetItem_properties($hWnd, $iIndex=1, $sText="465464", $iSubItem=0)
  Local $iBuffer, $pBuffer, $tBuffer, $iItem, $pItem, $tItem, $pMemory, $tMemMap, $pText, $iResult
  $tItem   = DllStructCreate($tagLVITEM)
  DllStructSetData($tItem, "size", 16 )
 
EndFunc

My script isnt working.....

I dot know a lot with dll structure ect.....

Sorry for pour english.

Edited by slaughter
Link to comment
Share on other sites

looking on webs i found this for c+

case WM_CREATE:
GetClientRect (hWnd, &Rc);
InflateRect (&Rc, -10, -10);
 
StatusArea = DisplayArea = Rc;
StatusArea.top = StatusArea.bottom - 32;
DisplayArea.top += 32;
DisplayArea.bottom = StatusArea.top - 10;
 
EditWnd = CreateWindowEx (WS_EX_STATICEDGE | WS_EX_CLIENTEDGE, "EDITCTL", NULL,
                WS_VISIBLE | WS_CHILD | ES_AUTOHSCROLL,
                Rc.left, Rc.top, Rc.right - 
                Rc.left, 22,
                hWnd, (HMENU) IDC_EDIT, hInst, NULL);
 
SendMessage (EditWnd, EM_SETMARGINS, EC_LEFTMARGIN | EC_RIGHTMARGIN, MAKELONG (8, 8));
SendMessage (EditWnd, WM_SETFONT,
         int (GetStockObject (DEFAULT_GUI_FONT)),
         MAKELPARAM (false, 0));
DisplayFont = CreateFont (-12, 0, 0, 0, FW_DONTCARE, false, false, false, OEM_CHARSET,
                OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                DEFAULT_PITCH | FF_DONTCARE, "Arial");
SetFocus (EditWnd);
break;

culd it help for me?

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