Hi folks --

I'm trying to accomplish something, which I alluded to in a couple previous 
posts. Although the responses were helpful in identifying the events I should 
work with, I'm still sort of stuck on the code. Hopefully someone can get me 
(more) started. To make it easy to understand, I'll talk about a hypothetical 
app which is quite similar to what I'm trying to do--without the professional 
field-specific jargon I would otherwise use.

Think about a standalone application, i.e., "MyBase" style DB, that was going 
to be used for taking medical histories. Users would be presented with a form 
with edit boxes for their name, address, etc. This form would also include a 
grid--this is where the non-demographic info is collected. For the sake of my 
example, let's suppose the grid has only two columns. The first column 
(column[0]) asks questions, and users supply their answers in column[1]. To 
make it convenient for users, some--but not all--of the cells in column[1] 
might include a pickList, e.g., cells with 'yes' or 'no' responses, but not 
cells where people enter a number or other kind of response. 

Although everybody is going to be filling in their name, address, etc., the 
rest of the history--the stuff in the grid--may differ for different patients, 
e.g., a returning patient vs. a new patient, or a child vs. an adult. You have 
to be able to load a different 'template,' for lack of a better term.

The way I'm viewing this, there's a ClientDataSet (CDSMaster) with (string) 
fields for name, address, etc. and a dataSet field for the info stored in the 
grid. The grid's data is bound to a nested dataSet (CDSDetail). 

With this in mind, you're ready for the things I haven't been able to do. 
(Thanks for reading this far :-) First, how do I set the app up so that when 
one is inserting a new record into the main db, the desired template-like info 
shows up in the grid (keeping in mind that next week you may be asking the grid 
to load a different set of questions...the info that will be displayed can't be 
hard coded in)? I understand, from when I alluded to this before, that we're 
talking about something that's going to happen with the CDSMain's OnNewRecord 
event handler. 

Second, how would one set up column[1] to have, essentially, pickLists that 
might vary by cell. I understand it's probably code that goes in the grid's 
OnColEnter event handler.

Just so you don't think I'm trying to get you to just do my work for me, (a) no 
one is paying me to do this :-) and (b) I wrote an app that does most of this 
for me, using a ValueListEditor component (instead of a DBGrid). ValueList 
Editor makes customized pickLists fairly simple. That app, however, is clumsy 
and brittle--the ValueListEditor is not DB aware, so I have it constantly 
loading and saving text to an invisible DBMemo component. I don't like the 
arrangement, and would prefer using DBGrid (or JvDBGrid) to trying to make a DB 
aware ValueList Editor.

Thanks, in advance, as always! -- Al
_______________________________________________
Delphi-DB mailing list
Delphi-DB@elists.org
http://www.elists.org/mailman/listinfo/delphi-db

Reply via email to