AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Determining which listview row was clicked to modify text

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
crxvfr



Joined: 10 Mar 2006
Posts: 55

PostPosted: Wed Aug 20, 2008 4:10 pm    Post subject: Determining which listview row was clicked to modify text Reply with quote

I am using listview to create a list of products in a web order. The number of products vary so I build the listview with a loop.

First (in the begining of the script) I create the listview...

Gui, Add, ListView, grid gChangeListView x6 y27 w520 h530, MFG|PART NUMBER|DESCRIPTION|QTY|COST

...later, I run thru a loop to parse data from an xml file saved as a text file...


loop
{
....parse a_loopreadline info into these vars.....
LV_Add("", mfg, itemcode, itemdescription, quantity, unitcost)
LV_ModifyCol()
}

the glabel for the listview snatches the data from the row and opens another gui with editboxes containing the cell data for that row.

ChangeListView:
if A_GuiEvent = DoubleClick
{
LV_GetText(MFG, A_EventInfo, 1)
LV_GetText(ItemCode, A_EventInfo, 2)
LV_GetText(ItemDescription, A_EventInfo, 3)
LV_GetText(Quantity, A_EventInfo, 4) ; Get the text of the first field.
LV_GetText(UnitCost, A_EventInfo, 5) ; Get the text of the first field.
if ErrorLevel MsgBox Could not open "%FileDir%\%FileName%".
gosub, ModifyOrderGUI
}
return

...the second gui where adjustments are made....

ModifyOrderGUI:
Gui, 2:Add, Text, x0 y0 w106 h19 , MFG
Gui, 2:Add, Text, x106 y0 w230 h19 , %MFG%
Gui, 2:Add, Text, x0-4 y20 w106 h19 , Part Number
Gui, 2:Add, Edit, x106 y20 w230 h19 , %ItemCode%
Gui, 2:Add, Text, x0 y40 w106 h19 , Description
Gui, 2:Add, Text, x106 y40 w230 h19 , %ItemDescription%
Gui, 2:Add, Text, x0 y60 w106 h19 , Quantity
Gui, 2:Add, Edit, x106 y60 w230 h19 , %Quantity%
Gui, 2:Add, Text, x0 y80 w106 h19 , Cost
Gui, 2:Add, Edit, x106 y80 w230 h19 , %UnitCost%
Gui, 2:Add, Button, x26 y110 w130 h30 , Cancel
Gui, 2:Add, Button, x186 y110 w130 h30 gModifyOrder, OK
Gui, 2:Show, x259 y137 h142 w341, Modify Order
Return

here is where I'm stupid....

ModifyOrder:
gui, 2:submit
LV_Modify(Row, itemcode, PART NUMBER)
LV_Modify(Row, quantity, QTY)
LV_Modify(Row, unitcost, COST)
return

Everything seems to work except that the listview does not get updated.

How do I know which row was clicked? Is it in a_GuiEvent?

Can somebody please give me an example of what the LV_Modify should look like?

-or-

Is it the correct method or do I need to add more instruction to make it work?
Back to top
View user's profile Send private message
crxvfr



Joined: 10 Mar 2006
Posts: 55

PostPosted: Wed Aug 20, 2008 5:18 pm    Post subject: Reply with quote

bump.

doh! ...da, ...burrying my own post by answering others.
Back to top
View user's profile Send private message
crxvfr



Joined: 10 Mar 2006
Posts: 55

PostPosted: Wed Aug 20, 2008 8:14 pm    Post subject: Reply with quote

Trying to keep this post from slipping to page two...

Is what I'm trying to do impossible?

I have since managed to edit the field in the list view with the code below but its changing every row because ThisRow is coming up as 0.

ModifyOrder:
ThisRow:=A_EventInfo
msgbox, ThisRow=%ThisRow%
Gui, 2:Submit
Gui, 2:Destroy
Gui, 1:Default
LV_Modify(ThisRow,"Col2",ItemCode)
LV_Modify(ThisRow,"Col4",Quantity)
LV_Modify(ThisRow,"Col5",UnitCost)
return
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group