Course list http://www.c-jump.com/bcc/
Lab 7 added customizable file selection dialog to the application. However, some operating systems have very complex and specific file choosers that many users prefer to access to specifically, instead of FLTK's home-grown file chooser. The library provides Fl_Native_File_Chooser class, which invokes the operating system's native file chooser dialog box.
In this lab we replace Fl_File_Chooser with Fl_Native_File_Chooser to display the standard file selection dialog:
The prototype for this project is Lab 7:
c255labs\labs\c255_lab07_file_chooser
Make a copy of Lab 7 subfolder, or download and unzip c255_lab07_file_chooser.zip
Rename the new folder as c255_lab08_native_chooser.
Open solution file in Visual Studio and finish the usual steps to rename the project.
Open CMainWindow.h in text editor. Here is the new code. Note that the pointer to the Fl_File_Chooser object has been removed.
// CMainWindow.h
#ifndef _CMAINWINDOW_H_INCLUDED_
#define _CMAINWINDOW_H_INCLUDED_
#include "../fluid_project/CFluidWindow.h"
#include <FL/Fl_Shared_Image.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_Native_File_Chooser.H> // NEW
class CMainWindow : public CFluidWindow {
Fl_Image* jpeg_image;
public:
CMainWindow();
void show();
void click_btn_show_jpeg();
// callback functions
static void callback_window_closing(Fl_Widget* widg, void* userdata_);
static void callback_btn_show_jpeg(Fl_Widget* widg, void* userdata_);
};//class CMainWindow
#endif // _CMAINWINDOW_H_INCLUDED_
Download the new version of CMainWindow.cpp file. Compile and test the program. Use WinMerge to compare the old and the new versions of the file. What are the differences? What are the similarities?
This is a self-learning lab. There are no files to submit. Make sure to complete all required steps to build and test the project on your own home computer.