Jump to content
Sign in to follow this  
mrbig1479

Edit text inside GUICtrlCreateListView ?

Recommended Posts

mrbig1479

Hi

I want to edit the text inside the GUICtrlCreateListView and them after editing the text i want to be able to save it.

here is an example script i made to make myself more clear

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiListView.au3>
#include <ListviewConstants.au3>

$Form1 = GUICreate("Price Editor", 689, 469, 201, 115,-1,$WS_EX_ACCEPTFILES)
Local $simStyle = bitOR($LVS_EDITLABELS,$LVS_SINGLESEL)
Local $extended = BitOR($LVS_EX_GRIDLINES,  $LVS_EX_SUBITEMIMAGES)
GUISetBkColor(0x00E0FFFF)
$GUI_list1 =  GUICtrlCreateListView("", 10, 104, 670, 330, $simStyle,$extended)
_GUICtrlListView_InsertColumn($GUI_list1, 0, "Card Name ", 280)
_GUICtrlListView_InsertColumn($GUI_list1, 1, "Price 1", 80)
_GUICtrlListView_InsertColumn($GUI_list1, 2, "Price 2", 80)
_GUICtrlListView_InsertColumn($GUI_list1, 3, "Price 3",80)
_GUICtrlListView_InsertColumn($GUI_list1, 4, "Price 4", 80)

_GUICtrlListView_AddItem($GUI_list1, "Row 1: Col 1", 0)
_GUICtrlListView_AddSubItem($GUI_list1,0,"Sub Item 1 ",1)
_GUICtrlListView_AddSubItem($GUI_list1,0,"Sub Item 2 ",2)
_GUICtrlListView_AddSubItem($GUI_list1,0,"Sub Item 3 ",3)
_GUICtrlListView_AddSubItem($GUI_list1,0,"Sub Item 4 ",4)
_GUICtrlListView_AddItem($GUI_list1, "Row 2: Col 1", 1)
_GUICtrlListView_AddSubItem($GUI_list1,1,"Sub Item 21 ",1)
_GUICtrlListView_AddSubItem($GUI_list1,1,"Sub Item 22 ",2)
_GUICtrlListView_AddSubItem($GUI_list1,1,"Sub Item 23 ",3)
_GUICtrlListView_AddSubItem($GUI_list1,1,"Sub Item 24 ",4)

GUISetState(@SW_SHOW)

Do
        $msg = GUIGetMsg()

Until $msg = $GUI_EVENT_CLOSE

I want to be able to edit Sub Item 21 ,Price 1 etc.... ( i thought that if i use $LVS_EDITLABELS i can do that ..) any help will be much appreciated :P

thanks

Share this post


Link to post
Share on other sites
rasim

mrbig1479

Example:

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>

Opt("GuiCloseOnESC", 0)

Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0

Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT)

$hGUI = GUICreate("ListView Subitems edit in place", 300, 200)

$hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 2, 2, 296, 196, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)

For $i = 1 To 10
    _GUICtrlListView_AddItem($hListView, "Item " & $i)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1)
Next

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $hWndFrom, $iCode

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
   
    Switch $hWndFrom
        Case $hListView
            Switch $iCode
                Case $NM_DBLCLK
                    Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)

                    If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
                        $Item = $aHit[0]
                        $SubItem = 0
                        Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
                    ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
                        $Item = $aHit[0]
                        $SubItem = $aHit[1]
                        Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
                    Else
                        Return $GUI_RUNDEFMSG
                    EndIf
                    
                    Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
                    Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
                    $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 10, 17, $Style)
                    
                    _GUICtrlEdit_SetSel($hEdit, 0, -1)
                    _WinAPI_SetFocus($hEdit)
                    $hDC = _WinAPI_GetWindowDC($hEdit)
                    $hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
                    FrameRect($hDC, 0, 0, $iLen + 10 , 17, $hBrush)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")
    
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)
    
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $iCode = BitShift($wParam, 16)
   
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    Local $iText = _GUICtrlEdit_GetText($hEdit)
                    _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)
                    _WinAPI_DeleteObject($hBrush)
                    _WinAPI_ReleaseDC($hEdit, $hDC)
                    _WinAPI_DestroyWindow($hEdit)
                    
                    $Item = -1
                    $SubItem = 0
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

:P

Share this post


Link to post
Share on other sites
mrbig1479

mrbig1479

Example:

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>

Opt("GuiCloseOnESC", 0)

Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0

Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT)

$hGUI = GUICreate("ListView Subitems edit in place", 300, 200)

$hListView = _GUICtrlListView_Create($hGUI, "Items|SubItems", 2, 2, 296, 196, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)

For $i = 1 To 10
    _GUICtrlListView_AddItem($hListView, "Item " & $i)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1)
Next

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState()

Do
Until GUIGetMsg() = $GUI_EVENT_CLOSE

Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $hWndFrom, $iCode

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
   
    Switch $hWndFrom
        Case $hListView
            Switch $iCode
                Case $NM_DBLCLK
                    Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)

                    If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
                        $Item = $aHit[0]
                        $SubItem = 0
                        Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
                    ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
                        $Item = $aHit[0]
                        $SubItem = $aHit[1]
                        Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
                    Else
                        Return $GUI_RUNDEFMSG
                    EndIf
                    
                    Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
                    Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
                    $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 10, 17, $Style)
                    
                    _GUICtrlEdit_SetSel($hEdit, 0, -1)
                    _WinAPI_SetFocus($hEdit)
                    $hDC = _WinAPI_GetWindowDC($hEdit)
                    $hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
                    FrameRect($hDC, 0, 0, $iLen + 10 , 17, $hBrush)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")
    
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)
    
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $iCode = BitShift($wParam, 16)
   
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    Local $iText = _GUICtrlEdit_GetText($hEdit)
                    _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)
                    _WinAPI_DeleteObject($hBrush)
                    _WinAPI_ReleaseDC($hEdit, $hDC)
                    _WinAPI_DestroyWindow($hEdit)
                    
                    $Item = -1
                    $SubItem = 0
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc

:P

Works like a charm , Thanks alot

now i need to figure out what you did...

Share this post


Link to post
Share on other sites
Andreik

Works like a charm , Thanks alot

now i need to figure out what you did...

What part from his code you don't understand?


When the words fail... music speaks

Share this post


Link to post
Share on other sites
mrbig1479

Ok now i have another problem , this is the example script

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>

Opt("GuiCloseOnESC", 0)
$I=0
$SETS_CTRL_DATA=""
$NUMBEROFSETS=46
Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0
Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT)
$hGUI =GUICreate("Price Editor", 689, 469, 201, 115)
GUISetBkColor(0x00E0FFFF)
$hListView = _GUICtrlListView_Create($hGUI, "", 10, 100, 496, 355, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)
_GUICtrlListView_InsertColumn($hListView, 0, "Card name", 180)
_GUICtrlListView_InsertColumn($hListView, 1, "Sell price", 80)
_GUICtrlListView_InsertColumn($hListView, 2, "foil sell price", 80)
_GUICtrlListView_InsertColumn($hListView, 1, "Buy price", 80)
_GUICtrlListView_InsertColumn($hListView, 2, "foil buy price", 80)
$Button_Load = GUICtrlCreateButton("Load", 24, 24, 75, 25, 0)
$Button_save = GUICtrlCreateButton("Save", 104, 24, 75, 25, 0)
$Button_Delete = GUICtrlCreateButton("Delete", 184, 24, 75, 25, 0)
$Combo_type = GUICtrlCreateCombo("Rares", 280, 24, 145, 25)
GUICtrlSetData(-1, "Commons|Uncommons|Mystic", "Rares")
$Combo_Sets = GUICtrlCreateCombo("ALA", 432, 24, 145, 25)


While $I <= $NUMBEROFSETS - 1
    $SETS_CTRL_DATA=$SETS_CTRL_DATA&Conert_set_to_number($I)&"|"
    $I=$I+1
WEnd

$SETS_CTRL_DATA=StringTrimRight ($SETS_CTRL_DATA,1)
GUICtrlSetData(-1, $SETS_CTRL_DATA, "ALA") 
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetOnEvent($Button_Load, "LOAD_EDITOR")
GUICtrlSetOnEvent($Button_save, "SAVE_EDITOR")


For $i = 1 To 43
    _GUICtrlListView_AddItem($hListView, "Item" & $i)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 2)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 2)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 3)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 4)
Next


GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState(@SW_SHOW)

Do
    $msg = GUIGetMsg()

Until $msg = $GUI_EVENT_CLOSE
    
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $hWndFrom, $iCode
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hListView
            Switch $iCode
                Case $NM_DBLCLK
                    Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)
                    If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
                        $Item = $aHit[0]
                        $SubItem = 0
                        Local $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
                        ConsoleWrite ($aRect[0],$aRect[1])
                    ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
                        $Item = $aHit[0]
                        $SubItem = $aHit[1]
                        Local $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
                    Else
                        Return $GUI_RUNDEFMSG
                    EndIf
                    Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
                    Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
                    $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $aRect[0] + 3, $aRect[1], $iLen + 10, 17, $Style)
                    _GUICtrlEdit_SetSel($hEdit, 0, -1)
                    _WinAPI_SetFocus($hEdit)
                    $hDC = _WinAPI_GetWindowDC($hEdit)
                    $hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
                    FrameRect($hDC, 0, 0, $iLen + 10 , 17, $hBrush)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $iCode = BitShift($wParam, 16)
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    Local $iText = _GUICtrlEdit_GetText($hEdit)
                    _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)
                    _WinAPI_DeleteObject($hBrush)
                    _WinAPI_ReleaseDC($hEdit, $hDC)
                    _WinAPI_DestroyWindow($hEdit)
                    $Item = -1
                    $SubItem = 0
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc 
    
Func Conert_set_to_number($ED)
EndFunc
FUNC LOAD_EDITOR ()
EndFunc

FUNC SET_PRICE_ON_CONTROL($CARDNAME,$SELLING_PRICE,$SELLING_FOIL_PRICE ,$BUYING_PRICE,$BUYING_FOIL_PRICE)
EndFunc

FUNC SAVE_EDITOR ()
EndFunc

problem now that the bounding rectangle position is placed worng..

Edited by mrbig1479

Share this post


Link to post
Share on other sites
CodyBarrett

uhhh i also have a problem too.... i cant get it so i can edit the listitems..... when i can editem.... and i click on something else it change back..... how do you use the $LVS_EDITLABELS probperly

Share this post


Link to post
Share on other sites
rasim

Ok now i have another problem , this is the example script

problem now that the bounding rectangle position is placed worng..

Try this:

#include <GuiConstants.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>

Opt("GuiCloseOnESC", 0)
$I=0
$SETS_CTRL_DATA=""
$NUMBEROFSETS=46
Global $hEdit, $hDC, $hBrush, $Item = -1, $SubItem = 0

Global $Style = BitOR($WS_CHILD, $WS_VISIBLE, $ES_AUTOHSCROLL, $ES_LEFT)
$hGUI =GUICreate("Price Editor", 689, 469, 201, 115)
GUISetBkColor(0x00E0FFFF)
$hListView = _GUICtrlListView_Create($hGUI, "", 10, 100, 496, 355, BitOR($LVS_EDITLABELS, $LVS_REPORT))
_GUICtrlListView_SetExtendedListViewStyle($hListView, $LVS_EX_GRIDLINES)
_GUICtrlListView_InsertColumn($hListView, 0, "Card name", 180)
_GUICtrlListView_InsertColumn($hListView, 1, "Sell price", 80)
_GUICtrlListView_InsertColumn($hListView, 2, "foil sell price", 80)
_GUICtrlListView_InsertColumn($hListView, 1, "Buy price", 80)
_GUICtrlListView_InsertColumn($hListView, 2, "foil buy price", 80)
$Button_Load = GUICtrlCreateButton("Load", 24, 24, 75, 25, 0)
$Button_save = GUICtrlCreateButton("Save", 104, 24, 75, 25, 0)
$Button_Delete = GUICtrlCreateButton("Delete", 184, 24, 75, 25, 0)
$Combo_type = GUICtrlCreateCombo("Rares", 280, 24, 145, 25)
GUICtrlSetData(-1, "Commons|Uncommons|Mystic", "Rares")
$Combo_Sets = GUICtrlCreateCombo("ALA", 432, 24, 145, 25)


While $I <= $NUMBEROFSETS - 1
    $SETS_CTRL_DATA=$SETS_CTRL_DATA&Conert_set_to_number($I)&"|"
    $I=$I+1
WEnd

$SETS_CTRL_DATA=StringTrimRight ($SETS_CTRL_DATA,1)
GUICtrlSetData(-1, $SETS_CTRL_DATA, "ALA") 
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlSetOnEvent($Button_Load, "LOAD_EDITOR")
GUICtrlSetOnEvent($Button_save, "SAVE_EDITOR")


For $i = 1 To 43
    _GUICtrlListView_AddItem($hListView, "Item" & $i)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 1)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 2)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 2)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 3)
    _GUICtrlListView_AddSubItem($hListView, $i - 1, "SubItem " & $i, 4)
Next


GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
GUIRegisterMsg($WM_COMMAND, "WM_COMMAND")

GUISetState(@SW_SHOW)

Do
    $msg = GUIGetMsg()

Until $msg = $GUI_EVENT_CLOSE
    
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    Local $tNMHDR, $hWndFrom, $iCode
    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = DllStructGetData($tNMHDR, "hWndFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hListView
            Switch $iCode
                Case $NM_DBLCLK
                    Local $aRect
                    Local $aHit = _GUICtrlListView_SubItemHitTest($hListView)
                    
                    If ($aHit[0] <> -1) And ($aHit[1] = 0) Then
                        $Item = $aHit[0]
                        $SubItem = 0
                        $aRect = _GUICtrlListView_GetItemRect($hListView, $Item)
                    ElseIf ($aHit[0] <> -1) And ($aHit[1] > 0) Then
                        $Item = $aHit[0]
                        $SubItem = $aHit[1]
                        $aRect = _GUICtrlListView_GetSubItemRect($hListView, $Item, $SubItem)
                    Else
                        Return $GUI_RUNDEFMSG
                    EndIf
                    
                    Local $iItemText = _GUICtrlListView_GetItemText($hListView, $Item, $SubItem)
                    Local $iLen = _GUICtrlListView_GetStringWidth($hListView, $iItemText)
                    
                    Local $aPos = ControlGetPos($hGUI, "", $hListView)
                    Local $iX = $aPos[0] + $aRect[0] + 3
                    Local $iY = $aPos[1] + $aRect[1] - 2
                    
                    $hEdit = _GUICtrlEdit_Create($hGUI, $iItemText, $iX, $iY, $iLen + 10, 17, $Style)
                    _GUICtrlEdit_SetSel($hEdit, 0, -1)
                    _WinAPI_SetFocus($hEdit)
                    
                    $hDC = _WinAPI_GetWindowDC($hEdit)
                    $hBrush = _WinAPI_CreateSolidBrush(0x0000FF)
                    FrameRect($hDC, 0, 0, $iLen + 10 , 17, $hBrush)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc

Func FrameRect($hDC, $nLeft, $nTop, $nRight, $nBottom, $hBrush)
    Local $stRect = DllStructCreate("int;int;int;int")
    DllStructSetData($stRect, 1, $nLeft)
    DllStructSetData($stRect, 2, $nTop)
    DllStructSetData($stRect, 3, $nRight)
    DllStructSetData($stRect, 4, $nBottom)
    DllCall("user32.dll", "int", "FrameRect", "hwnd", $hDC, "ptr", DllStructGetPtr($stRect), "hwnd", $hBrush)
EndFunc

Func WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    Local $iCode = BitShift($wParam, 16)
    Switch $lParam
        Case $hEdit
            Switch $iCode
                Case $EN_KILLFOCUS
                    Local $iText = _GUICtrlEdit_GetText($hEdit)
                    _GUICtrlListView_SetItemText($hListView, $Item, $iText, $SubItem)
                    _WinAPI_DeleteObject($hBrush)
                    _WinAPI_ReleaseDC($hEdit, $hDC)
                    _WinAPI_DestroyWindow($hEdit)
                    $Item = -1
                    $SubItem = 0
            EndSwitch
    EndSwitch
   
    Return $GUI_RUNDEFMSG
EndFunc    
    
Func Conert_set_to_number($ED)
EndFunc
FUNC LOAD_EDITOR ()
EndFunc

FUNC SET_PRICE_ON_CONTROL($CARDNAME,$SELLING_PRICE,$SELLING_FOIL_PRICE ,$BUYING_PRICE,$BUYING_FOIL_PRICE)
EndFunc

FUNC SAVE_EDITOR ()
EndFunc

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  

×