Page 1 of 1

[resolved] Show a error message from a dialog box

Posted: Thu Apr 21, 2005 8:45 pm
by GianT
Hi, that's me again :D I made a dialog box and I would like to send a message in function of what the user wrote n the fields of the dialog box.
In fact, if he writes something wrong, I want to show a error message; if not, I want to validate the dialog box and show another message. I guess that some of you will talk me about wxvalidator, but I'm sure there is another solution...

I tried to do a message dialog in the main frame, but I cant access to it from the dialog box...

Posted: Thu Apr 21, 2005 9:29 pm
by NinjaNL
Have a look at TransferDataFromWindow? Perhaps this is what you need?

Posted: Thu Apr 21, 2005 9:33 pm
by GianT
Where can I find information about this?
I can't find it in the help file

Posted: Thu Apr 21, 2005 9:42 pm
by NinjaNL
There is some information in the help file, and you could also look at the wizard and dnd samples for examples of using it.

Posted: Fri Apr 22, 2005 3:58 pm
by GianT
I'm afraid I can't find any information about this in the help file, I just got ToULong and Treectrl sample when I search for TransferDataFromWindow.

Posted: Fri Apr 22, 2005 4:38 pm
by NinjaNL

Posted: Wed Apr 27, 2005 4:21 pm
by GianT
I read about this, but it doesn't seem to be what I need :? . It talks about transferring data to a child but how do I make this child? I remind that I want to show a validate or an error message when I click on the "OK" button of the dialog.
Do I have to make and place the code of a wxwindow in the code of the dialog box? So I could call a function named GetWIndow if I remeber well..

I have to find this, it is something which presence is really needed in all applications (in my opinion).

Posted: Wed Apr 27, 2005 7:43 pm
by GianT
Well I found what I was searching for. It was so simple...but as I didn't know, I couldn't do it obviously... It takes only one line or 2. When I check whether the condition is verified or not, I just write this:

- If it's ok:
wxMessageBox("User added.", "Error",wxOK, this);
Then I close the dialog box by

-If it's not ok
wxMessageBox("Login already used.", "Error",wxOK, this);

As you see that is very simple. I wonder if nobody did know about this answer, and the lack of help on this forum sometimes disappoints me...I think there are some users that know a lot and they should be more active (to my mind). Of course, I know that some people don't have much time; personally I come in the forum just when I have a problem to solve and when I'm there I answer to a question if I know the answer. That is just an observation, so don't worry about that.

Well thank you anyway to those who have already tried to answer me and those who managed to do it.