Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Need help showing how this is done! Settings Dialog UI 1. Now that there is an object that can be used to store settings, it

Need help showing how this is done!

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 wxBoxSizer. Pass in wxVertical as an argument for the new object. Using SetSizer, set the main sizer of the window to this sizer. 8. 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 wxSpinCurl. 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. wxSpinCtrl will require a new import. The file is "wx/spinctri.h" ii. For more help with the wxSpinCtrl, check out the documentation at https://docs.wxwidgets.org/stable/classwx_spin ctri.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. wxColourPickerCtrl will require a new import. The file is "wx/cirpicker.h" ii. For more help with the wxColourPickerCurl, check out the documentation at https://docs.wxwidgets.org/trunk/classwx_colour_picker ctri.html e. The wxSpinCtrl and wxColourPickerCtrl 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(WXOK | 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

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions