Solved

combobox.items.AddObject

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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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.

772 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

10 Experts available now in Live!

Get 1:1 Help Now