tabcontrol - Multiple Listviews on tab2 control -
here have problem multiple listview
controls on tab2
control.
in gui, have tab2
control 3 of tabs each have 1 listview control.
my problem when use lv_gettext()
, can't find way of distinguishing listview
fetch from.
to compound problem, there no way lv_add()
distinguish between listviews either.
normally, have distinguish between gui windows mygui:default
there doesn't appear option listview
controls.
how can this?
actually, there way specify listview. it mentions in docs, too.
basically, change default listview. can't direct functions particular listview, if change default listview, can operate on it. once changed, subsequent commands operate on new default.
you change this:
gui, listview, listviewname
or this, if need distinguish between gui windows:
gui, 3:listview, listviewname
here sample. paste script file , run see work.
basic methodology
#singleinstance,force gosub, showgui return showgui: gui, mainui:new, hwndmainui, listviews on tab2 gui, add, tab2, vtabs, one|two|three|four gui, tab, 1 gui,add, listview, r5 vlistview1 glistview1events +altsubmit -multi, col1|col2 lv_add("", "bob", "harry") lv_add("", "first", "listview") gui, tab, 2 gui,add, listview, r5 vlistview2 glistview2events +altsubmit -multi, col1|col2 lv_add("", "george", "harvey") lv_add("", "second", "listview") gui, tab, 3 gui,add, listview, r5 vlistview3 glistview3events +altsubmit -multi, col1|col2 lv_add("", "michael", "richard") lv_add("", "third", "listview") gui, tab, 4 gui,add, listview, r5 vlistview4 glistview4events +altsubmit -multi, col1|col2 lv_add("", "harold", "marcel") lv_add("", "fourth", "listview") gui, show return report: lv_gettext(firstcol, a_eventinfo, 1) lv_gettext(secondcol, a_eventinfo, 2) msgbox, %firstcol% : %secondcol% return listview1events: gui, mainui:listview, listview1 if(a_guievent == "normal"){ gosub, report } return listview2events: gui, mainui:listview, listview2 if(a_guievent == "normal"){ gosub, report } return listview3events: gui, mainui:listview, listview3 if(a_guievent == "normal"){ gosub, report } return listview4events: gui, mainui:listview, listview4 if(a_guievent == "normal"){ gosub, report } return
a better way
actually, there better, not-so-clumsy way, go garry handle multiple listviews.
in method, trick name listviews same name plus sequential number: listview1, listview2, listview3...
this way there can single glabel event handler: gui, mainui:listview, listview%tabnumber%
;-------- http://ahkscript.org/boards/viewtopic.php?f=5&t=3656 --- modified=20140531 tabnumber:=1 gui, mainui:new, hwndmainui, listviews on tab2 gui,add, tab2, gtabchange vtabnumber altsubmit, one|two|three|four gui,tab, 1 gui,add, listview, r5 vlistview1 glistviewevents +altsubmit -multi, col1|col2 lv_add("", "bob", "harry") lv_add("", "first", "111111111") gosub,width1 gui,tab, 2 gui,add, listview, r5 vlistview2 glistviewevents +altsubmit -multi, col1|col2 lv_add("", "george", "harvey") lv_add("", "second", "222222") gosub,width1 gui, tab, 3 gui,add, listview, r5 vlistview3 glistviewevents +altsubmit -multi, col1|col2 lv_add("", "michael", "richard") lv_add("", "third", "33333333") gosub,width1 gui, tab, 4 gui,add, listview, r5 vlistview4 glistviewevents +altsubmit -multi, col1|col2 lv_add("", "harold", "marcel") lv_add("", "fourth", "44444") gosub,width1 gui, show gosub,tabchange return mainuiguiclose: exitapp width1: t1=70 t2=140 lv_modifycol(1,t1) lv_modifycol(2,t2) lv_modifycol(2,"integer") return ;------------------------------------------------------------------------------------- tabchange: guicontrolget, tabnumber return ;------------------------------------------------------------------------------------- listviewevents: gui, mainui:listview, listview%tabnumber% if(a_guievent == "normal"){ lv_gettext(firstcol, a_eventinfo, 1) lv_gettext(secondcol, a_eventinfo, 2) msgbox, %firstcol% : %secondcol% } return
Comments
Post a Comment