Re: Topgrid combos



Martijn Tonies wrote:
The combo for the cell.

The CellCombo property of the grid refers to a TtsCombo for
that cell only.
Aha! That's what I couldn't come up with.

3. Locate a value, and make it the displayed value.
There are properties to do this automatically if you have a value
for the cell.
This one? Which of the 2 columns am I looking at?
tsGrid1ComboLCompareValue(Sender: TObject; ComboString,
CurrentCellString: String; Len: Integer; var CompareRes: Integer);
That's an event, not a property.

Did you read the Help on the TopGrid yet?
Yes I did. Twice. I see properties and methods. What I don't see is how
to access any of them. This what you're talking about?

TtsComboLCompareValueEvent = procedure (Sender: TObject; ComboString,
CurrentCellString: string; Len: Integer; var CompareRes: Integer) of
object;
property OnComboLCompareValue: TtsComboLCompareValueEvent;

Applies to
TtsGrid.

Description
Use the OnComboLCompareValue event if you want to supply your own
comparison routine for locating the current cell's value in the combo
box's drop down list. The CurrentCellString is the current cell's
value,
the ComboString is the value from the combo drop down. The event
handler
should compare the ComboString with the CurrentCellString for the first
Len characters.

The event is used to compare the current cell's value to a value in the
drop down list when the AutoSearch property of the combo box is turned
on and the CompareType property is set to stOwn. ComboString is the
Use AutoSearch = True - that should do the trick if the combo is filled.
And which of the 400 combos in my grid will this return a value for? You
have provided *NO* way to refer to an individual combo. Please keep in
mind I'm trying to do this programatically, NOT by clicking on a combo.

See above. You can read the help as good as I can.
True. But if I had found it I wouldn't be asking the question, now would I?

The AutoSearch property is a property of the combo.

4. It would be nice to be able to load the combos in some other way
than typing in the values 1 by 1 in the designer.
There's an event that you can use to fill the combo from code.
Correct event?
tsGrid1ComboCellLoaded(Sender: TObject;
Combo: TtsComboGrid; DataCol, DataRow: Integer; var Value:
Variant);
Ehm, there's also OnComboDropDown or somethign like that.
OK. From help on OnComboDropDown:

TtsComboCellEvent = procedure (Sender: TObject; Combo: TtsComboGrid;
DataCol, DataRow: Longint) of object;

property OnComboDropDown: TtsComboCellEvent;

So how would I use this to store the string 'Mikey' in the combo at co1
1, row 1 of the grid?
This even will be fired whenever a combo drops down, so you can
use it to put values in the drop down grid of the combo.
The Combo param is already filled with a valid ComboGrid instance.
Huh? I don't want to do it on a click. I want to do it programmaticaly.

Did you read what I wrote?
Yep.

You can fill your combo programmatically as soon as a user
requests the combo to be opened.

You do this by using that particular event.
OK. I was wanting to fill it in the OnCreate for the form, but this will work.

As written in the Help:
"OnComboDropDown occurs just before the combo box appears."

"Write an OnComboDropDown event handler when you want to initialize the
combo box for a cell."

What more do you want? Besides complaining against me while I'm offering
free help
I'm sorry if you're offended. I think you are the type who wants the student to work for their answers, and I understand and endorse that point of view myself. But if you offer yourself in this arena, you have to be prepared to accomodate the slower ones if you wish to be a good teacher.

Experiment a bit, you'll find it ;)
I would, if only I could find the starting point. Which I think is:
How do I refer to a particular combo?

Read the help, I've given you everything you need.

I appreciate the time you've put into this, but it hasn't gotten me any
closer to a solution. Prehaps I haven't expressed my issues clearly
enough, but I'm at a loss as to how to do it better. Bottom line, I
can't figure out how to get at the combo in code. For instance for a
TCombobox there is a name property. So I can say MyCombo.text, or
MyCombo.Itemindex, or MyCombo.Additem('Mikey'). For a Ttsgrid there is a
name property. So I can refer to a cell like this: MyGrid[1,1] :=
'mikey'. But for a combo in a Ttsgrid I can't say MyCombo.whatever.
A code snippet would be great.

The CellCombo property does what you need!
Martijn -
I think I have what I need now. I really do appreciate your aid. Happy programming!!
Mike
.



Relevant Pages

  • Re: Topgrid combos
    ... In the TtsCombo, there, I believe, shouldbe a Grid property ... And one refers to a Ttscombo instance how? ... The combo for the cell. ... have provided *NO* way to refer to an individual combo. ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: How to reference cells once converted to Template Column *UPDATE*
    ... once I convert a bound column to a templated problem. ... > How do a refer to the Text in that cell AFTER I have displayed the grid? ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)
  • Re: Topgrid combos
    ... I have a grid with 2 combo boxes per row. ... How do I refer to them in code? ... I believe Cell[... ... Database development questions? ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: Lookup data
    ... (with unique data as stated) ... > I have Excel 2003 and a grid of data. ... > immediately to the right of the cell that matches the data. ... > to the whole grid of data - it would have to refer ...
    (microsoft.public.excel.worksheet.functions)
  • Re: Grid and Array Association
    ... When all the calculations are completed, you want to put the total ... count for each date in the cell just below that date. ... Loop through GridArray assigning the date found at the top of the grid ... called dResult. ...
    (microsoft.public.vb.general.discussion)