wxFileDirPickerEvent Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

wxFileDirPickerEvent

Post by Widgets »

I am using a file picker control to allow the user to select a base directory and want to be able to allow the user to specify a, possibly non-existent, directory at that level.
As there seems to be only one event generated for both initial selection as well as for every key stroke from the user, I was wondering what criteria I might be able to use to sort out which it was?
The issue arises because I want to allow the user to specify the directory via some predefined macros, such as {date} or {user} which will eventually be expanded to the current date, or the log in name for the user.

At this point I would like to verify that the entered data either specifies a valid macro or directory name, hence my attempts to 'classify' the input.
Any hints or pointers?
TIA
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxFileDirPickerEvent

Post by evstevemd »

Am not sure if I understand the question. But what about checking if there is a macro in that path? I mean if you have few macros you can push them in wxArrayString and do check like

Code: Select all

for(auto macro : macroList)
{
    if(path.Contains(macro))
    {
        //do your thing here
    }
}
Check if wxFileName class have anything that can help in your endevour

HTH
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: wxFileDirPickerEvent

Post by Widgets »

Yes, I can check that once the user presses Enter of otherwise finishes entry; I wanted to catch any errors before that.
The only way I see at present is to use a validator for the text field. It gives me an event for every key pressed.
Still working on that, so I'll have to see if that gives me what I need.
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
User avatar
evstevemd
Part Of The Furniture
Part Of The Furniture
Posts: 2409
Joined: Wed Jan 28, 2009 11:57 am
Location: United Republic of Tanzania

Re: wxFileDirPickerEvent

Post by evstevemd »

In that case you can use GetTextCtrl() and bind it to whatever event suits you (Seems like you need TEXT_UPDATED event). It gives you more control!
Chief Justice: We have trouble dear citizens!
Citizens: What it is his honor?
Chief Justice:Our president is an atheist, who will he swear to?
Widgets
Ultimate wxWidgets Guru
Ultimate wxWidgets Guru
Posts: 534
Joined: Thu Jun 01, 2006 4:36 pm
Location: Right here!

Re: wxFileDirPickerEvent

Post by Widgets »

That is where I am at.
Just have to now implement the necessary logic :-)
Environment: Win 10/11 64-bit & Mint 21.1
MSVC Express 2019/2022
wxWidgets 3.2.2
Post Reply