|
Post by jahoyle on Jan 21, 2024 15:07:42 GMT -5
Can i use a two dimensional array in a combo box?
I have data stored in a random access file, 6 fields per record. I would like to display a whole record for editing. I can do ok with a one dimensional array, but that's not what I want.
Any suggestions, help, criticisms would be greatly appreciated.
|
|
|
Post by badbug on Jan 21, 2024 19:42:27 GMT -5
No sure if this is what you are after. If you are using HTML it's, this will work.
You can display the record num along with the field names. It displays the record nummber and the 6 fields. If the select 1, you can get both values of 'a,b,c,d,e,f' and the value 1.
<select name="example"> <option value="a,b,c,d,e,f">1</option> <option value="a2,a3,a4,a5,a6">2</option> <option value="b1,b2,b3,b4,b5,b6">Other</option> </select>
Of course as you know there are much simpler ways to do this. Just use the html "<table>" which has a lot more options. Such as using <buttons> for "Add","Chg", and "Del" for each record displayed, and put your data in a SQLite table for easier access and maintenance.
Not sure this is what you are looking for. Hope this helps.
|
|
|
Post by jahoyle on Jan 21, 2024 21:03:19 GMT -5
I appreciate your reply, but i know absolutely nothing about html. My skills as a programmer are sadly limited.
|
|
gaslouk
Full Member
Hi from beautiful Greece.
Posts: 130
|
Post by gaslouk on Jan 21, 2024 23:32:36 GMT -5
HiSomething like this?
DIM Combo1$(10) dim a$(9,1) a$(0,0)="Gas" a$(1,0)="Louk" Combo1$(1) = a$(0,0)+" "+a$(1,0) Combo1$(2) = a$(1,0)+" "+a$(0,0)
[InitColors] 'Please use default colors when possible. 'ForegroundColor$ = "Black" 'BackgroundColor$ = "Buttonface"
True = 1 : False = 0
[WindowSetup] NOMAINWIN WindowWidth = 310 : WindowHeight = 415 UpperLeftX = INT((DisplayWidth-WindowWidth)/2) UpperLeftY = INT((DisplayHeight-WindowHeight)/2)
[ControlSetup] Menu #main, "&File" , "E&xit", [quit] stylebits #main.bt1, _BS_MULTILINE, 0, 0, 0 button #main.bt1, "Exit", [quit], UL, 50, 105, 90, 35 stylebits #main.bt2, _BS_MULTILINE, 0, 0, 0 button #main.bt2, "Button 2", button2Click, UL, 155, 105, 90, 35 ComboboxColor$ = "White" combobox #main.combo1,Combo1$(), combo1Click, 50, 45, 170, 300
Open "Window Title" for Window as #main #main "trapclose [quit]" #main.combo1 "selectindex 1" #main "font ms_sans_serif 10"
[loop] Wait
[quit] close #main : END
Sub button2Click handle$ '#handle$ contains button handle End Sub
Sub combo1Click handle$ #handle$ "selection? Selected$" 'Selected$ contains text of item selected End Sub Gaslouk
|
|
|
Post by jahoyle on Jan 22, 2024 0:43:46 GMT -5
I'm in the process of studying your code right now. Takes me awhile, I'm old and slow. i ran it, and it seems to be what I'm looking for. i just need to understand it. i really do appreciate you taking the time to help me.
|
|
|
Post by Rod on Jan 22, 2024 5:34:15 GMT -5
|
|
|
Post by tsh73 on Jan 22, 2024 7:44:47 GMT -5
0) If you can read all these 6 fields from single long line first place 1) If you keep fields separated by spaces 2) and make sure your fields does not exceed field length (or it will be silently truncated by PUT) Then I think it will work OK. From RAF, you GET a record concatenate fields via space to single line of combobox Then after editing you split that line into fields with WORD$ and then PUT. EDIT after second thought that implied your fields do not contain spaces If it is you have to hink harder may be keep some extra separator, like '|', in a combo box line. This could indeed get hairy...
|
|
|
Post by badbug on Jan 22, 2024 9:57:21 GMT -5
If it's just a small array this may not be what you want. If it's large this may help. Using this, there is no limit on the size of your data. If you only want to maintain the fields, you can use rbGen to generate the program for you. You need to put the table in a SQLite db. Then run rbGen. It allows Add,Change,Delete, search, sort, and page listing. I think it uses the GRID to list the data. rbGen
|
|
|
Post by tsh73 on Jan 22, 2024 10:04:06 GMT -5
jahoyle, could you post a few lines (>=3) of sample data? May be totally bogus, but of similar size/ type (ei integer or date)/ having spaces quotes ets So we can guess how it should look like.
|
|