Sign in to follow this  
Followers 0
marcsusy

special character

5 posts in this topic

I would like to know how to place the symbol √ in a column on GUICtrlCreateListView

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I would like to know how to place the symbol √ in a column on GUICtrlCreateListView

As an item or as the column header?

As an item in the first column and the 2nd Row

local $width = 400
local $height = 400
$mylist = GUICtrlCreateListView("column 1 |column 2 |column 3 ", 0, 0, $width, $height)
$item1 = GUICtrlCreateListViewItem("col1|col2|col3", $mylist)
$item1 = GUICtrlCreateListViewItem("√ |col2|col3", $mylist)

As column header in the third column example:

local $width = 400
local $height = 400
$mylist = GUICtrlCreateListView("column 1 |column 2 |√ ", 0, 0, $width, $height)
Edited by monoscout999

Share this post


Link to post
Share on other sites

my problem is I do not know how to write the √ symbol, I tried and I get a player v AutoIt ascii characters do not, I write using the Wingdings font ü but I can not write it in the gui GUICtrlCreateListViewItem

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

You can use unicode characters to display it:

Example:

MsgBox(0, "Unicode", ChrW(8730))

A table can be found here: http://www.homepage-total.de/html/unicode-tabelle.php

Br,

UEZ

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Share this post


Link to post
Share on other sites

You also could set the font used to paint the Listview manually to Wingdings by hooking in the WM_NOTIFY $NM_CUSTOMDRAW sequence.

Added #AutoIt3Wrapper_UseX64=n because there seems to be something wrong in the structures which makes it fail on x64 ($tagNMLVCUSTOMDRAW wrong?).

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_UseX64=n
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>
#include <GuiImageList.au3>
#include <WindowsConstants.au3>
#include <WinApi.au3>
#include <FontConstants.au3>

$h_ListView_Font = _WinAPI_CreateFont(14, 0, 0, 0, 500, False, False, False, $DEFAULT_CHARSET, $OUT_DEFAULT_PRECIS, _
        $CLIP_DEFAULT_PRECIS, $PROOF_QUALITY, 0, "Wingdings")

Global $hListView

_Main()

_WinAPI_DeleteObject($h_ListView_Font)

Func _Main()

    Local $GUI, $hImage
    $GUI = GUICreate("(UDF Created) ListView Create", 400, 300)

    $hListView = _GUICtrlListView_Create($GUI, "", 2, 2, 394, 268)
    _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT, $LVS_EX_SUBITEMIMAGES))
    GUISetState()

    GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")

    ; Load images
    $hImage = _GUIImageList_Create()
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0xFF0000, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x00FF00, 16, 16))
    _GUIImageList_Add($hImage, _GUICtrlListView_CreateSolidBitMap($hListView, 0x0000FF, 16, 16))
    _GUICtrlListView_SetImageList($hListView, $hImage, 1)

    ; Add columns
    _GUICtrlListView_InsertColumn($hListView, 0, "Column 1", 100)
    _GUICtrlListView_InsertColumn($hListView, 1, "Column 2", 100)
    _GUICtrlListView_InsertColumn($hListView, 2, "Column 3", 100)

    ; Add items
    _GUICtrlListView_AddItem($hListView, "Row 1: Col 1", 0)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 2", 1)
    _GUICtrlListView_AddSubItem($hListView, 0, "Row 1: Col 3", 2)
    _GUICtrlListView_AddItem($hListView, "Row 2: Col 1", 1)
    _GUICtrlListView_AddSubItem($hListView, 1, "Row 2: Col 2", 1)
    _GUICtrlListView_AddItem($hListView, "Row 3: Col 1", 2)
    _GUICtrlListView_AddItem($hListView, "ü", 3)

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

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam

    Local $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    Local $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    Local $nNotifyCode = DllStructGetData($tNMHDR, "Code")

    Switch $hWndFrom
        Case $hListView
            Switch $nNotifyCode
                Case $NM_CUSTOMDRAW
                    Local $tCustDraw = DllStructCreate($tagNMLVCUSTOMDRAW, $ilParam)
                    Local $iDrawStage = DllStructGetData($tCustDraw, "dwDrawStage")
                    If $iDrawStage = $CDDS_PREPAINT Then Return $CDRF_NOTIFYITEMDRAW
                    If $iDrawStage = $CDDS_ITEMPREPAINT Then Return $CDRF_NOTIFYSUBITEMDRAW
                    Local $iItem = DllStructGetData($tCustDraw, "dwItemSpec")
                    Local $hDC = DllStructGetData($tCustDraw, 'hdc')
                    _WinAPI_SelectObject($hDC, $h_ListView_Font)
                    If Mod($iItem, 2) = 1 Then ;odd row number (0-based)
                        DllStructSetData($tCustDraw, "clrTextBk", 0xF5F5F5)
                        Return $CDRF_NEWFONT
                    EndIf
                    Return $GUI_RUNDEFMSG
            EndSwitch
    EndSwitch
EndFunc   ;==>WM_NOTIFY

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