|
|
|||||||
i would like to use a file with content as a selection for a "combobox". this file is a "database" to store some informations. i seareched the board and test some udf, but i find nothing that helps me. either i´m seraching for the wrong subject or i´m to n00bie to get the answer hope someone can help me, thanks a lot. |
||||||||
|
|
|||||||
Phadda ... is the type 'database' a given fact or is there freedom in format ? Ask that because of type 'ini' is much easier to implement |
||||||||
|
|
|||||||
wow, fast answer i luv this board and the community, much better than the gamercommunity k back to the thread... well the content of this file is only a single phrase which contains number/letter for example XH342d12Df, but it is possible that the phrase can be build with specialchars and/or larger than 10 chars and/or smaller. but it will never be more than one "word" each line. i hope you understand what i mean, as a german my "schoolenglish" is hmmmm 10 years old hehe |
||||||||
|
|
|||||||
to show what I am after : break on $ini = @scriptdir + "\cbo.ini" $list = split(readprofilestring($ini,"List",""),chr(10)) redim preserve $List[ubound($list) -1] $form = createobject("kixtart.form") $cbo1 = $form.ComboBox $cbo1.List = $List $cbo1.ListIndex = 0 $form.Show while $form.visible $=execute($form.Doevents) loop exit Plus cbo.ini : code:hth[list] Jochen |
||||||||
|
|
|||||||
k, phadda, with your current format... something like: code:$=open(1,"DBfile.txt") [ 27. February 2003, 13:47: Message edited by: Lonkero ] |
||||||||
|
|
|||||||
thought that over and suggest doing the same as I did in PostPrep (simplified) Testscript: break on $form = createobject("kixtart.form") $cbo1 = $form.ComboBox $cbo1.List = split(readprofilestring(@scriptdir + "\cbo.ini","ComboBoxes","cbo1"),',') $cbo1.ListIndex = 0 $form.Show while $form.visible $=execute($form.Doevents) loop exit Ini-file (easy to enhance ) : code:J.[ComboBoxes] |
||||||||
|
|
|||||||
why you keep pulling that ini-file? thought he has no ini-file. wonder how the file is generated or is he doing it himself. if latter, ini is good option but if some soft does it, simple read is easier. btw, you should get that proxy fixed! got no chat friends during coffee breaks |
||||||||
|
|
|||||||
Yeah ... the proxy admin remain dead , awaiting the next I think Phadda indeed has control about the method the file is created , so I'll stick with ini |
||||||||
|
|
|||||||
thank you very much, when i read the lines from your both post it looks like a simple script ;-) i test both scripts and "sorry" to jpols, but the idea with an ini file is nice but it is too much for my small "database" :-) i prefer the example from lonkero, but i think i got a small problem with it. the combolist is not splited and i got only one value like "1 2 3 4 5 6". is there a import problem from the databasefile? i add the values in the file with this line: code:i expect that the "chr(10)" makes the prob... |
||||||||
|
|
|||||||
nope. I just forgot one argument from the split. updated it. now, is the file only one line having all the stuff or multiple lines with one option each? the script I wrote assumes the latter. |
||||||||
|
|
|||||||
the file contains one option each line and the lines are seperated with a cr. because it is much better for the manual fixing this file when they seperated each line one option |
||||||||
|
|
|||||||
k, so the updated scriptlet (above) works. |
||||||||
|
|
|||||||
Phadda, Are you wanting a list or combobox with multiple columns (to display many fields in a database) ? If so, might want to start looking into the ListView object. -Shawn [ 27. February 2003, 14:45: Message edited by: Shawn ] |
||||||||
|
|
|||||||
@shawn i only want a simple pulldown with a "dynamic database" content, like the "KIXPAD" font combobox and i think mister never sleep lonkero hehe helped me to get a little bit closer to my problem |
||||||||
|
|
|||||||
Still think that ini-based solution is easier/more reliable/faster ! (I even have coded a 'working' ini-based 4 player network game ) How 'small' will the database be ? [ 27. February 2003, 15:44: Message edited by: jpols ] |
||||||||
|
|
|||||||
ok ... got the chance to discuss this further on PMs with Phadda Did a short sample to show that it is possible to control the contents of a Combobox dynamically description : ComboBox 2 controls the amount of items in ComboBox 1 (Not the contents though; Think we need a deeper explanation of what exactly you try to achieve) You'll see that the script doesn't even need the ini file at first start ... Ah yeah ... and of course the Script 'remembers' the Items for next run break on Global $List[0] $ini = @scriptdir + "\cbo.ini" $List = split(readprofilestring($ini,"ComboBoxes","cbo1"),',') $form = createobject("kixtart.form") $cbo1 = $form.ComboBox $cbo1.Location = 5, 30 $cbo1.List = $List $cbo1.ListIndex = 0 $cbo2 = $form.ComboBox $cbo2.Location = $cbo1.Right + 5, 30 $cbo2.List = 0,1,2,3,4,5,6,7 $cbo2.ListIndex = ubound($List) $cbo2.OnClick = "cbo2_Click($$cbo2.ListIndex)" $lbl1 = $form.Label("cbo1:",5,10,80,15) $lbl2 = $form.Label("Items in cbo1:",$cbo2.Left,10,120,15) $form.Show while $form.visible $=execute($form.Doevents) loop exit function cbo2_click($i) dim $, $i redim $List[0] if $i for $ = 0 to $i - 1 redim preserve $List[$i] $List[$] = "ITEM" + ($+1) next redim preserve $list[ubound($List)-1] endif $cbo1.List = $List $cbo1.ListIndex = 0 $ = writeprofilestring($ini,"ComboBoxes","cbo1",join($List,',')) endfunction hth [Updated on 3rd of March with a more reliable version ] [ 03. March 2003, 14:03: Message edited by: jpols ] |