Solved

Posted on 2001-07-13
2,487 Views
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
cells[i, j] := surname;

for the combobox, I have query data set like
firstName, a, b
firstname is string, a, b are integer

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

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
Question by:petershaw8
1 Comment

LVL 9

Accepted Solution

ITugay earned 100 total points
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);
....

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

### Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.