What I would like to do is have a field at the top, where some one could enter something like last name. Under that I would like to display what the Select clause would pull up for matches in maybe 10-12 rows.
Example:
Name: Ha
Last Name | First Name | State
Haesslein Bill TX
Harry John NJ
Haven Stan LA
What I don't understand is (1) how to setup the screen for the Rows with the Titles above them. (2)Then how do I get the data from the SQL to the Rows for output. I have looked at Brian D. Pugh's Bookshop as an example, but he is way beyond my knowledge of EBasic and I got lost in his code. I am not saying his code has any problems, I am just saying what he is doing is beyond my understanding of the language. I can do the SQL, it is the setup of the Titles about the rows, and how the rows are defined and how you take the SQL values and load them into the rows. I have looked in everything I have and still do not understand what I need to do to make this work.
Thanks for any help,
Bill
Hi,
Have a look at the addressbook sample that Paul Turley wrote
It's a one-table database that's probably easier to follow
Brian
Try this one http://www.ionicwind.com/forums/index.php/topic,701.0.html
It might help.
Hi,
Here's a very rough idea that puts all the work onto a simple listbox.
It has the benefit of sorting the items for display, but it needs some thought to get the columns nicely displayed .. :)
window w
int wstyle,key,i
string users[20]
string a$,s$
autodefine "OFF"
wstyle = @SIZE|@MINBOX|@MAXBOX
OPENWINDOW w,50,50,500,400,wstyle,0,"SQL Display",&handler
SETWINDOWCOLOR w,RGB(0,0,80)
CONTROL w,@Button, "Exit", (500-70)/2, 300, 70, 35, 0, 1
CONTROL w,@Button, "Search", (500-70)/2, 70, 70, 30, 0, 2
CONTROL w,@Edit, "", (500-100)/2, 20, 100, 30, 0, 3
CONTROL w,@listbox,"",(500-350)/2,180,350,80,@CTLISTSORT|@Vscroll,4
control w,@static,"Last Name",80,150,100,22,@CTEDITCENTER,5
control w,@static,"First Name",200,150,100,22,@CTEDITCENTER,6
control w,@static,"State",320,150,100,22,@CTEDITCENTER,7
setupdata()
WAITUNTIL w = 0
END
SUB handler
SELECT @CLASS
case @IDCLOSEWINDOW
' closing the window sets w = 0
CLOSEWINDOW w
case @IDCHAR
' pressing the 'ESC'(ape) key will abort the program ...
key = @CODE
if (key = 27) then CLOSEWINDOW w
case @IDCONTROL
select @CONTROLID
' clicking the Exit button ...
case 1
CLOSEWINDOW w
case 2
' clicking the Search button ...
Search()
' any other controls go here ...
endselect
ENDSELECT
RETURN
ENDSUB
sub setupdata
users[1] = "Morris Leslie OR"
users[2] = "Haesslein Bill TX"
users[3] = "Harry John NJ"
users[4] = "Peterson Jack NY"
users[5] = "Haven George LA"
users[6] = "Rubenstein Ron TX"
users[7] = "Haven Stan LA"
users[8] = "Hall Jim TX"
users[9] = "Smith Fred LA"
return
endsub
sub Search
int nlist,n
nlist = 0
do
DELETESTRING(w,4,0)
until (GETSTRING(w,4,0) = "")
s$ = ltrim$(rtrim$(GETCONTROLTEXT (w, 3)))
n = len(s$)
for i = 1 to 19
a$ = users[i]
if (a$ <>" ")
if (left$(a$,n) = s$)
ADDSTRING(w,4,a$)
nlist = nlist + 1
endif
endif
next i
if (nlist = 0) then addstring(w,4,"No matching item")
return
endsub
Best wishes, :)
Graham
To Brian Pugh, I have tried to compile the Address Book program and it seems to blow up in this line:
IF LEFT$(sqliteversion(),1)<>"2"
I only have EBasic online, no longer use or have IBasic Pro online, still own it, but have upgraded to EBasic.
To Rock Ridge Farm (Larry), probably would be an excellent example, for Aurora, but that is even farther out of my league.
To GWS (Graham), will give the code a try and see if I can follow it.
Thanks to all of you,
Bill
That is not the sample brian was talking about. An addressbook program is included with the Emergence BASIC install. Look in your "Projects" directory under "Database Examples" for the program addressbook.eba
Paul.
To Brian, what I am trying to get the selected data to look like is your BookShop program on the Bottom Left side or Right Side. I like the way it looks and am trying to emulate what you did, but I can not figure out how you did it. So any help will really be appreciated.
Thanks,
Bill
Bill,
Take a look at this example I dug up. Not as much code, and should be easier to follow. Put both files in the same directory, and re-compile
You might need Fletchie's ctl files, if you haven't got them already
Hope this helps somewhat,
Brian
Brian, that is exactly what I needed. It is an excellent example. I have already modified it to put in your colors and the gridlines from your BookShop program. This looks more like something I can follow and modify to my needs.
So, thank you very much for the excellent example. I plan on sharing the code when I get done. It will be a program to keep track of people who go to car shows. It will have a Name and Address table, a table with what types of cars they have shown up with and another table with the dates and scores for each car. It may take a while to write, but I thought it would be a good way for me to learn how to do data base in EBasic.
Thanks again,
Bill