Board index » cppbuilder » TDriveCombo update for new drives

TDriveCombo update for new drives


2008-07-19 12:41:33 AM
cppbuilder66
If I place a TDriveCombo on a form then when the form is opened the thing
generates a list of the drives currently present. If a new 'drive' is
inserted, i.e., a USB stick or anything else that looks to Windows like a
'drive', this list is not updated until the form is closed and re-opened.
Is it possible to make TDriveCombo re-generate the list? I.e., as an
alternative to making the thing using new and providing means of killing it
and re-making when the user does the insertion. I am prepared to do that if
necessary and assume I will need to do it also with the associated
DirectoryList thingy.
With the common use now of such transient drives I am surprised the thing
has not bee enhanced to provide this. Perhaps there is an alternative
component I just haven't yet come across? It must be a common requirement
and I am sure someone somewhere has an elegant solution.
Derek
 
 

Re:TDriveCombo update for new drives

"Derek Harvey" < XXXX@XXXXX.COM >wrote in message
Quote
If a new 'drive' is inserted, i.e., a USB stick or anything else
that looks to Windows like a 'drive', this list is not updated
until the form is closed and re-opened.
TDriveComboBox does not listen to system notifications at all, so it cannot
update itself automatically. The drive list is generated only when the
TextCase property is changed or when the HWND is recreated.
Quote
Is it possible to make TDriveCombo re-generate the list?
The easiest way is to call its RecreateWnd() method after you have detected
a change in the available drives.
Quote
With the common use now of such transient drives I am
surprised the thing has not bee enhanced to provide this.
TDriveComboBox is a old Win3.1 component. There are plenty of third-party
components available that are enhanced to work with Win9x+ systems, shell
updates, etc. Search around. Or look at Borland's own Shell Controls
package, if you have the source files installed for it.
Gambit
 

Re:TDriveCombo update for new drives

Thanks. I don't recognise the term 'Shell Controls'. How would I tell
whether I have got it. I installed, I think, everything that came with
Builder 2007 Professional, although perhaps not what came on the 'Partner
Software' disk. There seems to be no new equivalent to this on the component
palette (where indeed DriveCombo is in the Win3.1 group).
How do I get Shell Controls if I do not have it?
Thanks again.
Derek
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Derek Harvey" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>If a new 'drive' is inserted, i.e., a USB stick or anything else
>that looks to Windows like a 'drive', this list is not updated
>until the form is closed and re-opened.

TDriveComboBox does not listen to system notifications at all, so it
cannot update itself automatically. The drive list is generated only when
the TextCase property is changed or when the HWND is recreated.

>Is it possible to make TDriveCombo re-generate the list?

The easiest way is to call its RecreateWnd() method after you have
detected a change in the available drives.

>With the common use now of such transient drives I am
>surprised the thing has not bee enhanced to provide this.

TDriveComboBox is a old Win3.1 component. There are plenty of third-party
components available that are enhanced to work with Win9x+ systems, shell
updates, etc. Search around. Or look at Borland's own Shell Controls
package, if you have the source files installed for it.


Gambit

 

{smallsort}

Re:TDriveCombo update for new drives

Thanks Remy. Changing TextCase seems to do the trick. I would NEVER have
thought to try that to achieve this effect. It can be changed back in the
same function. Possibly not even necessary to make an actual change, just
set the property. This solution is satisfactory for me.
RecreateWnd() is reported by the compiler as 'inaccessible' so presumably
private or protected; probably TextCase calls it?
Thanks again.
Derek
"Remy Lebeau (TeamB)" < XXXX@XXXXX.COM >wrote in message
Quote

"Derek Harvey" < XXXX@XXXXX.COM >wrote in message
news: XXXX@XXXXX.COM ...

>If a new 'drive' is inserted, i.e., a USB stick or anything else
>that looks to Windows like a 'drive', this list is not updated
>until the form is closed and re-opened.

TDriveComboBox does not listen to system notifications at all, so it
cannot update itself automatically. The drive list is generated only when
the TextCase property is changed or when the HWND is recreated.

>Is it possible to make TDriveCombo re-generate the list?

The easiest way is to call its RecreateWnd() method after you have
detected a change in the available drives.

>With the common use now of such transient drives I am
>surprised the thing has not bee enhanced to provide this.

TDriveComboBox is a old Win3.1 component. There are plenty of third-party
components available that are enhanced to work with Win9x+ systems, shell
updates, etc. Search around. Or look at Borland's own Shell Controls
package, if you have the source files installed for it.


Gambit