Solved

combobox.items.AddObject

Posted on 2001-07-13
1
2,507 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
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…

943 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now