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 

Multiple Listviews and how to direct actions each

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



Joined: 28 Sep 2007
Posts: 273
Location: New York

PostPosted: Thu Jan 17, 2008 12:40 am    Post subject: Multiple Listviews and how to direct actions each Reply with quote

I have a GUI with multiple ListViews and I was wondering if anyone could tell me how I can specify which listview to make changes to.

Currently all of my LV commands are controlling the BulletinList by default, how can I have it give different commands to the PartsList LV?


Code:
Gui, Color, E6E6E6
Gui, +AlwaysOnTop
Menu, FileMenu, Add, Add...      Ctrl+A, MenuFileAdd
Menu, FileMenu, Add, New         Ctrl+N, OpenNew
Menu, FileMenu, Add, Exit          Ctrl+Delete, GuiClose
Menu, HelpMenu, Add, &About, MenuHandler
Menu, MyMenuBar, Add, &File, :FileMenu  ; Attach the two sub-menus that were created above.
Menu, MyMenuBar, Add, &Help, :HelpMenu
Menu, MyContextMenu, Add, Clear Selection, ContextClearRows
Gui, Menu, MyMenuBar
Gui, Add, Tab, x-4 y0 w1090 h530 , Product|General|Partial
Gui, Add, DropDownList, x30 y30 w100 h150 gProductgroup vproductgroup, Spectrum|DFC|Genesis|OneBox|OEM|DC|MW
Gui, Add, DropDownList, x30 y55 w100 h150 gunittype vunit,
;Gui, Add, Edit, x160 y35 w175 h190 vpartslist
Gui, Add, ListView, Grid x160 y35 w175 h190 vPartsList, Parts|Quantity
Gui, Add, ListView, Grid x28 y80 w105 h150 vBulletinList, Bulletin List

Gui, Tab, General
Gui, Font, s13
Gui, Add, Text, x50 y35 w400 h20 , Please complete all information:
Gui, Font, s8
Gui, Add, Text, x48 y55 w400 h20 cRed, (To cancel the program at any time use Ctrl+Delete)
Gui, Add, Text, x95 y80 w120 h20 , CSD Number:
Gui, Add, Edit, x176 y80 w100 h20 vjobnum, CSD
Gui, Add, Text, x103 y110 w120 h20 , SR Number:
Gui, Add, Edit, x176 y110 w100 h20 vsrnum,
Gui, Add, Text, x41 y140 w120 h20 , Deliver to (select or type):
Gui, Add, combobox, x176 y140 w120 h150 vdeliverto, DFC|SPECTRUM|GENESIS|MW|S26 (Medical)|S23 (Medical)|OEM|ONEBOX|
Gui, Add, Radio, x107 y180 w70 h20 veni, ENI
Gui, Add, Radio, x202 y180 w70 h20 vmed, MED
Gui, Add, Button, x67 y210 w70 h20, OK
Gui, Add, Button, x217 y210 w70 h20, Cancel
Gui, Add, Text, x310 y70 w100 h20 , Pricing?
Gui, Add, Radio, x312 y85 w70 h20 vpricing, Yes
Gui, Tab, Partial
Gui, Font, s13
Gui, Add, Text, x100 y35 w400 h20 , Enter Part Numbers:
Gui, Font, s8
Gui, Add, Text, x130 y60 w200 h20 , Part Number:
Gui, Add, Edit, x110 y80 w120 h20  vPart1,
Gui, Add, Edit, x110 y105 w120 h20  vPart2,
Gui, Add, Edit, x110 y130 w120 h20  vPart3,
Gui, Add, Edit, x110 y155 w120 h20  vPart4,
Gui, Add, Edit, x110 y180 w120 h20  vPart5,
Gui, Add, Button, x67 y210 w70 h20, OK
Gui, Add, Button, x217 y210 w70 h20, Cancel
Gui, Show, x278 y217 h240 w377, Oracle - Parts Review V2.42
Return


ButtonCancel:
GuiClose:
ExitApp

ButtonOK:
Gui, Submit, nohide
Return



Productgroup:
{
productlist = |
GuicontrolGet, productgroup

Loop, T:\Service Rochester\user\Files used by Programs (Please don't touch)\Service Bulletins\%productgroup%\*, 2
  productlist = %productlist%%A_loopfilename%|

LV_Delete()
GuiControl,, unit, %productlist%
GuiControl,, parts, |
}

unittype:
{
GuicontrolGet, unit
LV_Delete()
 Loop, T:\Service Rochester\user\Files used by Programs (Please don't touch)\Service Bulletins\%productgroup%\%unit%\*.txt,,
  {     
  StringTrimRight, filename, A_LoopFilename, 4
  LV_Add("",filename,1)
  }

LV_ModifyCol(1, 80)
}
return

















GuiContextMenu: 
if A_GuiControl <> BulletinList 
    return
Menu, MyContextMenu, Show, %A_GuiX%, %A_GuiY%
return


ContextClearRows: 
RowNumber = 0 
Loop
{
    RowNumber := LV_GetNext(RowNumber - 1)
    if not RowNumber 
        break
    LV_Delete(RowNumber) 
}
return




ExitApp

^DELETE::
ExitApp
Return






#IfWinActive Oracle - Parts Review V2.42
^A:: 
MenuFileAdd:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
InputBox, expenseadd, User Input, Please input the part number for the "Do Not Pull" item you would like to add:
If expenseadd !=
 {
 FileAppend, %expenseadd%`n, T:\Service Rochester\user\Files used by Programs (Please don't touch)\Expense.txt
 }
return

MenuHandler:
Gui +OwnDialogs
MsgBox, Version 2.42`nDate last revised 01/02/2008`nCreated By: user
return

^n::
OpenNew:
Gui +OwnDialogs
Reload
Return


ENTER::
NUMPADENTER::
GoSub, ButtonOK
Return


Last edited by ribbs2521 on Fri Aug 07, 2009 3:30 am; edited 1 time in total
Back to top
View user's profile Send private message
Lexikos



Joined: 17 Oct 2006
Posts: 7295
Location: Australia

PostPosted: Thu Jan 17, 2008 1:00 am    Post subject: Reply with quote

ListView -- Built-in Functions for ListViews wrote:
If the window has more than one ListView control, by default the functions operate upon the one most recently added. To change this, specify Gui, ListView, ListViewName, where ListViewName is the name of the ListView's associated variable or its ClassNN as shown by Window Spy. Once changed, all existing and future threads will use the indicated ListView.
Back to top
View user's profile Send private message Visit poster's website
ribbs2521



Joined: 28 Sep 2007
Posts: 273
Location: New York

PostPosted: Thu Jan 17, 2008 1:12 am    Post subject: Reply with quote

Thanks, so how would I put something like LV_Add? Where would I put the name of the LV to add to?

Sorry, dumb question, after reading closer I understand it now. Thank You for your help
Back to top
View user's profile Send private message
acowbear



Joined: 14 May 2006
Posts: 45

PostPosted: Sat Feb 23, 2008 5:08 am    Post subject: Reply with quote

gui, 1:default ;Tells it you want to work with gui #1
gui, Listview, myfavoritefoodlist ;Tells it you want to work with whatever Listview has the associated variable "myfavoritefoodlist"
LV_Add("","cheese")

you give your listviews associated variables when you create them, like this...
Gui, Add, ListView, x26 y40 w170 h280 +grid vmyfavoritefoodlist, 1|2|3
Back to top
View user's profile Send private message
Display posts from previous:   
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