Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Delphi ListBox.setfocus problem...

Posted on 2003-11-19
7
Medium Priority
?
980 Views
Last Modified: 2010-04-05
can anyone give me a source of a working listbox.setfocus command in delphi, because i always get array error.
thanks in advance :)
0
Comment
Question by:bbh2k3
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 9785057
??

where is the problem?
maybe you should show what you do

procedure TForm1.Button1Click(Sender: TObject);
begin
  if listbox1.CanFocus then
    listbox1.SetFocus;
end;

meikl ;-)
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9787450
You are getting an array error? It is NOT coming from the listbox because Listbox deosn't use arrays.
If you post the code you are using and the COMPLETE error message, we can help you.
0
 
LVL 2

Expert Comment

by:Robn
ID: 9788997
I have never seen this problem before but I have had issues where SetFocus causes errors (especially on 3rd party components in ActiveX forms) and I solved this by using SetFocus in the Windows unit.

Example
SetFocus(ListBox1.Handle);

However, like EddieShipman said, this seems to be something other than a SetFocus error. The ListBox will use arrays in the OS to manage the items but I have never seen this error in Delphi before.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:bbh2k3
ID: 9799885
i wanted to do it like, when i add a line in the listbox, to automatically scoll down the bar to see the line added.
sorry about my poor english .. ;)
0
 
LVL 2

Accepted Solution

by:
Robn earned 200 total points
ID: 9799915
Index := ListBox1.Items.Add(...);
ListBox1.ItemIndex := Index;
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 9800078
[quote]when i add a line in the listbox, to automatically scoll down the bar to see the line added[/quote]

What would that have to do with setting focus to the listbox, anyway?

Robn gave you the correct answer to do that but it can be shortened to:

ListBox1.ItemIndex := ListBox1.Items.Add(...);



0
 

Author Comment

by:bbh2k3
ID: 9801709
thanks for the help guys, i really apriciate, keep it going!
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Suggested Courses

609 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