Solved

combobox.items.AddObject

Posted on 2001-07-13
1
2,570 Views
Last Modified: 2007-12-19
I use a stringgrid and a combobox.
for the stringgrid, I have query data set like
surname, a, b
surname is string, a, b are integer
I may add
cells[i, j] := surname;

for the combobox, I have query data set like
firstName, a, b
firstname is string, a, b are integer
items.add(firstName);

I want to add a, b into stringgrid and combobox items as objects.

So the statements above should change to
stringgrid.object[i, j]
and
combobox.items.addobject[index]

after added these object
I need to write a loop to find the mathch objects between that in combobox and that in stringgrid.

so how can I add object to stringgrid and combobox?
and how can I compare the object in the combobox and in the stringgrid?

Peter

0
Comment
Question by:petershaw8
1 Comment
 
LVL 9

Accepted Solution

by:
ITugay earned 100 total points
ID: 6280726
Hi peter,

it is depend from how big your values A and B. If it is in [-32768..32768] then you can keep both values as integer. Integer is 32 bit length (the same as pointer), first 16 bits as A value, second is B.

var
  P: pointer;
begin
  P := pointer( A shl 16 or B);
....
  List.AddObject('string', P);

you can search:
var
  I: Integer;
begin
  // A - value
  for I := 0 to List.Count-1 do
    if Integer(List.Objects[I]) and $FFFF0000 shr 16 = SearchValueA then // do something
  // B- value
    if Integer(List.Objects[I]) and $FFFF = SearchValueB then // do something

------
Igor.
 




0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question