Page 1 of 1 1
Topic Options
#91588 - 2003-02-27 11:58 AM is it possible with kixforms...
Phadda Offline
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 [Wink] hope someone can help me, thanks a lot.

Top
#91589 - 2003-02-28 12:06 AM Re: is it possible with kixforms...
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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 [Smile]
_________________________



Top
#91590 - 2003-02-28 12:14 AM Re: is it possible with kixforms...
Phadda Offline
Fresh Scripter

Registered: 2003-02-15
Posts: 10
Loc: Germany
wow, fast answer [Smile] i luv this board and the community, much better than the gamercommunity [Wink]
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
#91591 - 2003-02-28 12:15 AM Re: is it possible with kixforms...
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
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:
[list]
Value1=ITEM1
Value2=ITEM2
Value3=ITEM3
Value4=ITEM4
Value5=ITEM5
Value6=ITEM6
Value7=ITEM7

hth
Jochen
_________________________



Top
#91592 - 2003-02-28 12:19 AM Re: is it possible with kixforms...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, phadda, with your current format...
something like:
code:
$=open(1,"DBfile.txt")
$file=readline(1)
while @error=0 $file=$file+chr(10)+readline(1) loop
for each $line in split($file,chr(10))
$combo.additem($line)
loop



[ 27. February 2003, 13:47: Message edited by: Lonkero ]
_________________________
!

download KiXnet

Top
#91593 - 2003-02-27 01:10 PM Re: is it possible with kixforms...
Jochen Administrator Offline
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 [Wink] ) :

code:
[ComboBoxes]
cbo1=ITEM1,ITEM2,ITEM3,ITEM4,ITEM5,ITEM6,ITEM7

J.
_________________________



Top
#91594 - 2003-02-27 01:13 PM Re: is it possible with kixforms...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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 [Wink]
_________________________
!

download KiXnet

Top
#91595 - 2003-02-27 01:26 PM Re: is it possible with kixforms...
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yeah ... the proxy admin remain dead , awaiting the next [Mad]

I think Phadda indeed has control about the method the file is created , so I'll stick with ini [Wink]
_________________________



Top
#91596 - 2003-02-27 01:33 PM Re: is it possible with kixforms...
Phadda Offline
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
#91597 - 2003-02-27 01:49 PM Re: is it possible with kixforms...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
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.
_________________________
!

download KiXnet

Top
#91598 - 2003-02-27 02:06 PM Re: is it possible with kixforms...
Phadda Offline
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 [Wink]
Top
#91599 - 2003-02-27 02:07 PM Re: is it possible with kixforms...
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, so the updated scriptlet (above) works.
_________________________
!

download KiXnet

Top
#91600 - 2003-02-27 02:17 PM Re: is it possible with kixforms...
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
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 ]

Top
#91601 - 2003-02-27 02:52 PM Re: is it possible with kixforms...
Phadda Offline
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 [Smile] and i think mister never sleep lonkero hehe helped me to get a little bit closer to my problem [Wink]

Top
#91602 - 2003-02-27 03:41 PM Re: is it possible with kixforms...
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Still think that ini-based solution is easier/more reliable/faster !
(I even have coded a 'working' ini-based 4 player network game [Big Grin] )

How 'small' will the database be ?

[ 27. February 2003, 15:44: Message edited by: jpols ]
_________________________



Top
#91603 - 2003-02-28 02:41 PM Re: is it possible with kixforms...
Jochen Administrator Offline
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 [Big Grin]

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 [Wink]



break on

Global $List[0]

$ini  = @scriptdir + "\cbo.ini"
$List = split(readprofilestring($ini,"ComboBoxes","cbo1"),',')

$form           = createobject("kixtart.form")

$cbo1           = $form.ComboBox
$cbo1.Location  = 530
$cbo1.List      = $List
$cbo1.ListIndex = 0

$cbo2           = $form.ComboBox
$cbo2.Location  = $cbo1.Right + 530
$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 [Roll Eyes] ]

[ 03. March 2003, 14:03: Message edited by: jpols ]
_________________________



Top
Page 1 of 1 1


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 329 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.065 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org