Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need Help on this assignment Settings Dialog UI 1. Now that there is an object that can be used to store settings, it makes sense

Need Help on this assignment

image text in transcribed
Settings Dialog UI 1. Now that there is an object that can be used to store settings, it makes sense to have the ability to change those settings. 2. This will require the use of a new control type called a wxDialog. 3. Create a new class that inherits from wxDialog. The wxWindow* will need to be passed in to this object so that is can be used by the wxDialog base class. The base class will need the parent, an ID (doesnis 't matter what it is), and a window title. 4. Since the point of this window is to configure settings, passing in a pointer to the dialog window would make sense. This can be done in the constructor or via a setter. 5. The main content of the dialog is going to be a box sizer that will stack controls vertically. 6. The controls that will be stored in this main box sizer will be a series of box sizers that will stack controls horizontally. Each of these boxes will contain a label and a control to set the value of the setting. 7. Create a wxboxSizer pointer for the main box and set it to a new wx BoxSizer. Pass in wixVertical as an argument for the new object. Using SetSizer, set the main sizer of the window to this sizer. B. There are two types of child box sizers that will be created. a. Both types will be a wxboxSizer that uses wxHorizontal as an argument. b. Both types will contain a label, which will be the wxStaticText control. The wxStaticText control takes in a parent (this], an ID (wxID_ANY], and the text to be displayed. c. One type of the child box will use a wxSpinCarl. This is a special type of text box that is used to select numbers. It is initialized like the label, but the ID is important because it will be used for setting up events. i. wxSpinCurl will require a new import. The file is "wx/spinetrLh" ii. For more help with the wxSpinCurl, check out the documentation at https://docs.wxwidgets.org/stable/classwx spin ctrl.html d. The other type of child box will use a wxColourPickerCurl. This is a control that allows the user to select a color. It is initialized with a parent and an ID, which needs to be tracked. i. wxColourPicker Curl will require a new import. The file is "wx/clrpicker.h" it. For more help with the wxColourPickerCurl, check out the documentation at https://docs.wxwidgets.org/trunk/classwx colour picker curl.html e. The wxSpinCarl and wx ColourPickerCurl objects will need to be declared in the dialog header file so that other methods can interact with them. 9. Create the child boxes for each of the settings that will be configured in this dialog box. It is not necessary to have all settings configured in one dialog box. Multiple dialogs can be used. 10. The final box to be added is a special box that contains buttons for OK and CANCEL. This is such a common item that wxWidgets provided a special function for create this sizer. Create a wxSizer* and set it equal to CreateButtonSizer(waOK | wxCANCEL) 11. After creating all of the boxes in the constructor with the spinner and color picker controls, the values of the controls should be set from the settings object pointer. Settings Dialog Events 1. An event table will be used for the events related to the spin control and the color picker control. 2. Add wxDECLARE_EVENT_TABLO() to the settings dialog header file. 3. Each spin control will need an event that takes in a wxSpinEvent& as its parameter. Add an event method to the header file for each spin control 4. Each color picker control will need an event that takes in a wxColourPicker Event& as its parameter. Add an event method to the header file for each color picker control. 5. In the implementation of each event method, the value from the event needs to be saved back to the settings object so it can be used outside of this window. 6. Following the syntax from the main window, add an event table to the settings dialog cpp file. 7. The event table will need to handle two kinds of event EVT_SPINCTRL and EVT COLOURPICKER_CHANGED. Connect those events to the appropriate IDs and event methods

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions