Solved

Updating a drivecombobox

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
code issue 8 156
Reconfigure Delphi Install? 2 61
I want to use librsync in my Delphi backup application. 3 59
Multi-layered image in FireMonkey 9 49
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…
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…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

820 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