#91588 - 2003-02-27 11:58 AM
is it possible with kixforms...
|
Phadda
Fresh Scripter
Registered: 2003-02-15
Posts: 10
Loc: Germany
|
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.
|
Top
|
|
|
|
#91590 - 2003-02-28 12:14 AM
Re: is it possible with kixforms...
|
Phadda
Fresh Scripter
Registered: 2003-02-15
Posts: 10
Loc: Germany
|
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
|
Top
|
|
|
|
#91593 - 2003-02-27 01:10 PM
Re: is it possible with kixforms...
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
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:
[ComboBoxes] cbo1=ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,ITEM6,ITEM7
J.
_________________________
|
Top
|
|
|
|
#91595 - 2003-02-27 01:26 PM
Re: is it possible with kixforms...
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
|
Top
|
|
|
|
#91596 - 2003-02-27 01:33 PM
Re: is it possible with kixforms...
|
Phadda
Fresh Scripter
Registered: 2003-02-15
Posts: 10
Loc: Germany
|
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:
$x = WriteLine( 1, '$content' + @CRLF )
i expect that the "chr(10)" makes the prob...
|
Top
|
|
|
|
#91598 - 2003-02-27 02:06 PM
Re: is it possible with kixforms...
|
Phadda
Fresh Scripter
Registered: 2003-02-15
Posts: 10
Loc: Germany
|
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
|
Top
|
|
|
|
#91601 - 2003-02-27 02:52 PM
Re: is it possible with kixforms...
|
Phadda
Fresh Scripter
Registered: 2003-02-15
Posts: 10
Loc: Germany
|
@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
|
Top
|
|
|
|
#91603 - 2003-02-28 02:41 PM
Re: is it possible with kixforms...
|
Jochen
KiX Supporter
Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
|
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 ]
_________________________
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 557 anonymous users online.
|
|
|