Tuesday 19 October 2021

Chapter 21 // Exercise 12 - Principles & Practice Using C++

In this exercise I am using Visual Studio 2019 and a modified version of the std_lib_facilities header found here.

Chapter 21 // Exercise 12

Provide a GUI interface for querying a file of Orders; e.g., "Find all orders from Joe," "Find the total value of orders in file Hardware," and "List all orders in file Clothing." Hint: First design a non-GUI interface; then, build the GUI on top of that.

Github: 

So the non-gui version can be found here:

I started to implement searching name, address, date and purchases, however it started taking up too much time and he only says name so I cut it back.

Chapter 21 // Exercise 12 - Principles & Practice Using C++

For the GUI version, I designed a new window called QueryOrderWindow and delved into a new FLTK widget; Fl_Text_Display. This class allows you display multiple lines of text with scrolling capabilities and other things but I only wanted to scroll.

I went over to GUI.h and added a new child of Widget called MultilineScroll_Outbox which creates an FL_Text_Display and Fl_Text_Buffer. You can then simply add text to the buffer. After that it was simply a matter of adding some buttons and pushing text to various places.

FLTK text Display scroll Chapter 21 // Exercise 12 - Principles & Practice Using C++

No comments:

Post a Comment