Solved

Updating a drivecombobox

Posted on 1998-07-22
5
531 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 76
Convert a string into a TDateTime 5 61
TEMBEDDEDWB how can i change its user agent ? 8 58
Delphi: barcode reading on android platform 1 30
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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