Solved

Updating a drivecombobox

Posted on 1998-07-22
5
528 Views
Last Modified: 2010-04-03
I'm using a drivecombobox on a form and would like to be able to update it by pressing a button.

When I say update, I mean that I mapped to a network drive while the program is already running, and would like my application to detect this new drive without me having to close and reopen the application.

If there is a way to detect the change and update without even having to associate it to a button... even better.

Thanks in advance
0
Comment
Question by:rafy
5 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1358473
Try this:
Maybe in OnTimer()....or you think of something...

DriveComboBox1.Update;//Updates and if there are new drives it will detect it hopefully...

Viktor Ivanov
0
 

Author Comment

by:rafy
ID: 1358474
Nope update doesn't do it... it only repaints the object...
0
 

Expert Comment

by:westy100697
ID: 1358475
Hey Rafy try  DlgDirListComboBox() in Win32 and see if that helps. You will have to look at the command yourself but it has the ability to add all the current Drives, Directories etc.

You may have to call  CB_RESETCONTENT to clear the drive box first and reset it and then use the first procedure I mentioned. See if it helps...

WESTY :)
0
 

Author Comment

by:rafy
ID: 1358476
No... too messy...

I already found a much better solution... delete and recreate the object....Works for me.

Consider this question deleted (I'd delete it but I don't see that option).
0
 
LVL 4

Accepted Solution

by:
itamar earned 50 total points
ID: 1358477
Hi rafy,

this is the source code for a component that brings a reload method you can call from a Timer event:

>>>>>

type
  TNewDriveComboBox = class(TDriveComboBox)
  private
  protected
  public
     procedure Reload; virtual;
  published
  end;

procedure Register;

implementation

procedure TNewDriveComboBox.ReLoad;
begin
  inherited BuildList;
end;

procedure Register;
begin
  RegisterComponents('Samples', [TNewDriveComboBox]);
end;
<<<<<<

IHTH,
Itamar
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

19 Experts available now in Live!

Get 1:1 Help Now