 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Rhys
Joined: 17 Apr 2007 Posts: 761 Location: Florida
|
Posted: Thu Apr 16, 2009 4:40 pm Post subject: Possible to Add Multiple ListView Columns using 1 Variable? |
|
|
| Code: | addtolists:
gui,listview,lv_1
loop,parse,new_orders,`r,`n
{
LV_Add("",A_LoopField)
} |
A_Loopfield in the code above is a single line of a CSV file - I was intending for it to add each value in the correct column, but it is adding the entire string into the 1st column instead. Is there an way to reference a variable for LV_Add() which contains comma-delimited strings in a way that will do this?
For example, I dynamically create the correct LV headers with this:
| Code: | getheaders:
fileread,new_orders,1new_orders.csv
loop, parse, new_orders, `r,`n
{
stringreplace, tab1header,A_Loopfield,`,,|,1
break
}
Return
drawgui:
;...
loop,6 ;CREATE LISTVIEWS
{
gui,tab,%A_Index%
gui,add,listview,r11 w480 vlv_%A_Index%,% tab%A_Index%header
;...
}
|
_________________ [Join IRC!]
 |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
Posted: Tue Apr 21, 2009 1:37 pm Post subject: |
|
|
Does this help?
| Code: | #NoEnv
Gui,Add,ListView,r2 w200, a|b|c|d|e|f|g
new_orders=
(
1,2,3,4,5,6,7
a,b,c,d,e,f,g
)
loop,parse,new_orders,`n
{
StringSplit,temp,A_LoopField,`, ;creates an Array of data
LV_Add("",temp1,temp2,temp3,temp4,temp5,temp6,temp7)
Loop % temp0
temp%A_Index%= ;Deletes old values
}
Gui,Show
Return
GuiClose:
ExitApp |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 761 Location: Florida
|
Posted: Wed Apr 22, 2009 6:43 pm Post subject: |
|
|
HotKeyIt, thank you for the suggestion, but this does not solve my problem exactly - I am looking for something that will work with an unknown number of columns. Creating the listview/header dynamically works just fine but adding items to the listview is where I am having trouble. I've got a workaround now that is kind of clumsy (but it works) that I will probably be posting in a little while.
Thanks! _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
HotKeyIt
Joined: 18 Jun 2008 Posts: 4652 Location: AHK Forum
|
Posted: Wed Apr 22, 2009 7:05 pm Post subject: |
|
|
I once faced this problem as well and just used that, I think ListView can handle more than 253 entries but LV_Add expression will be to long.
Have you got more than 253 columns?
Have you found a different solution? One that can add more than 253 columns?
| Code: | Gui,add,ListView,r20 w600,1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33
,|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59|60|61|62|63|64|65|66|67|68|69|70|71
,|72|73|74|75|76|77|78|79|80|81|82|83|84|85|86|87|88|89|90|91|92|93|94|95|96|97|98|99|100|101|102|103|104|105|106
,|107|108|109|110|111|112|113|114|115|116|117|118|119|120|121|122|123|124|125|126|127|128|129|130|131|132|133|134
,|135|136|137|138|139|140|141|142|143|144|145|146|147|148|149|150|151|152|153|154|155|156|157|158|159|160|161|162
,|163|164|165|166|167|168|169|170|171|172|173|174|175|176|177|178|179|180|181|182|183|184|185|186|187|188|189|190
,|191|192|193|194|195|196|197|198|199|200|201|202|203|204|205|206|207|208|209|210|211|212|213|214|215|216|217|218
,|219|220|221|222|223|224|225|226|227|228|229|230|231|232|233|234|235|236|237|238|239|240|241|242|243|244|245|246
,|247|248|249|250|251|252|253
file=
(
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,
1
1,2
)
Loop,Parse,file,`n
{
StringSplit,t,A_LoopField,`,
LV_Add("",t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16,t17,t18,t19,t20,t21,t22,t23,t24,t25,t26,t27,t28,t29,t30
,t31,t32,t33,t34,t35,t36,t37,t38,t39,t40,t41,t42,t43,t44,t45,t46,t47,t48,t49,t50,t51,t52,t53,t54,t55,t56,t57,t58,t59,t60
,t61,t62,t63,t64,t65,t66,t67,t68,t69,t70,t71,t72,t73,t74,t75,t76,t77,t78,t79,t80,t81,t82,t83,t84,t85,t86,t87,t88,t89,t90
,t91,t92,t93,t94,t95,t96,t97,t98,t99,t100,t101,t102,t103,t104,t105,t106,t107,t108,t109,t110,t111,t112,t113,t114,t115,t116
,t117,t118,t119,t120,t121,t122,t123,t124,t125,t126,t127,t128,t129,t130,t131,t132,t133,t134,t135,t136,t137,t138,t139,t140
,t141,t142,t143,t144,t145,t146,t147,t148,t149,t150,t151,t152,t153,t154,t155,t156,t157,t158,t159,t160,t161,t162,t163,t164
,t165,t166,t167,t168,t169,t170,t171,t172,t173,t174,t175,t176,t177,t178,t179,t180,t181,t182,t183,t184,t185,t186,t187,t188
,t189,t190,t191,t192,t193,t194,t195,t196,t197,t198,t199,t200,t201,t202,t203,t204,t205,t206,t207,t208,t209,t210,t211,t212
,t213,t214,t215,t216,t217,t218,t219,t220,t221,t222,t223,t224,t225,t226,t227,t228,t229,t230,t231,t232,t233,t234,t235,t236
,t237,t238,t239,t240,t241,t242,t243,t244,t245,t246,t247,t248,t249,t250,t251,t252,t253)
Loop 253
t%A_Index%=
}
Gui,Show
Return
GuiClose:
ExitApp |
_________________ AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun  |
|
| Back to top |
|
 |
Rhys
Joined: 17 Apr 2007 Posts: 761 Location: Florida
|
Posted: Wed Apr 22, 2009 7:42 pm Post subject: |
|
|
I'm using between 18-30 columns... I think what I am doing as a workaround is similar to what you've got there.. Basically I have a static 'matrix' of variables that are named LV_[1-30] where 30 is the maximum number of columns that I expect to have. I clear the entire dataset and then parse the rows using LV_%A_Index%:=Loopfield. Then I do a LV_Add() that has 30 column names.. The null ones are discarded luckily.
I probably won't deal with any more columns than 250+ so I probably won't worry too much about that limitation for now =) _________________ [Join IRC!]
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|