| |

VerySource

 Forgot password?
 Register
Search
View: 658|Reply: 2

How to call a function in the View class from a modeless dialog

[Copy link]

2

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 Invalid IP Address

Post time: 2020-1-14 10:40:02
| Show all posts |Read mode
After creating a non-modal dialog box, I set a button that requires a member function of the View class to be called after clicking this button. It is reasonable to add the header file of the View class to this dialog class, and then build the View class object in the dialog class. (Or pointer) to call its member functions, but (probably a larger system developed by many people) After adding the header file of the View class, a lot of errors occurred: <Compiled successfully before, but it failed to compile: <
I would like to ask: if you do not add the View class header file, can you make a custom member function of the View class respond to the message of clicking in a modeless dialog box? Thank you for your suggestion!
Reply

Use magic Report

5

Threads

23

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

Post time: 2020-1-17 23:36:01
| Show all posts
Pass the this pointer of the View class to the parent pointer of the dialog box, and operate through the pointer.
Reply

Use magic Report

2

Threads

5

Posts

4.00

Credits

Newbie

Rank: 1

Credits
4.00

 China

 Author| Post time: 2020-1-24 23:45:01
| Show all posts
Thank you血色占卜师
I overloaded the Creat function and changed one of the formal parameters (parent pointer) to the this pointer of the View class, OK :)
Thank you again
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list