Page 1 of 1

Large wxFileDialog [SOLVED]

Posted: Mon Jan 29, 2018 12:30 am
by Tony0945
I'm writing a simple app to be run on a raspberry pi wherein the user selects a video file to run. VLC does this but the font is too small to read unless you walk right up to the TV. A File seclection dialog is perfect except both the dialog and font seem to be a fixed size, too small.
I want the Dialog to fill the screen and the font large enough to be read across the room. Here's my code:

Code: Select all

#include "MovieServerApp.h"

IMPLEMENT_APP(MovieServerDlgApp)

bool MovieServerDlgApp::OnInit()
{
	wxFileDialog* dialog = new wxFileDialog(NULL,"Select Film to watch");
	wxFont font=dialog->GetFont();
	font.Scale(5.0);
	dialog->SetFont(font);
	dialog->SetWildcard("Video files (*.mpg)|*.mpg");
	dialog->SetDirectory("V:\\SageTV");
	SetTopWindow(dialog);
	while (dialog->ShowModal() == wxID_OK) // if the user clicks "Open" instead of "Cancel"
	{ 
		wxMessageBox("Selected "+ dialog->GetPath());
	}
 	exit(0);		
	return true;
}
 
int MovieServerDlgApp::OnExit()
{
	return 0;
}
The messageBox is to be changed later to wxExecute launching mplayer.
The above code has no effect no matter what value is passed to Scale().
Testing first in Windows. Haven't tried Linux yet.

Re: Large wxFileDialog

Posted: Mon Jan 29, 2018 3:32 pm
by ONEEYEMAN
Hi,
I don't think you can play with the standard dialogues behaviour like this.
Keep in mind that the HiDPI stuff is still WIP and not finished yet.

Thank you.

Re: Large wxFileDialog

Posted: Mon Jan 29, 2018 9:38 pm
by doublemax
I don't think there is a way to make the native filedialog do this.

You can however try to use the generic filedialog.

Code: Select all

#include "wx/generic/filedlgg.h"
...
wxGenericFileDialog dlg;
dlg.SetFont( GetFont().Scale(2.0) );
dlg.Create( this, "open file", "", "", "*.*",  wxFD_OPEN|wxFD_FILE_MUST_EXIST );

//dlg.OnReport( wxCommandEvent() );   // ugly. don't try this at home
dlg.ShowModal();
But the wxGenericFileDialog code is not linked to the library when a native implementation exists. Therefore you have to add its source file to your project. ( <wxdir>/src/generic/filedlgg.cpp )

I tested it under Windows and there it works. I don't know about Linux.

Re: Large wxFileDialog

Posted: Wed Jan 31, 2018 1:10 am
by Tony0945
Got it working on Windows with doublemax's suggestion. it's ugly but it scales. I can customize that generic dialog to look better. Also it always statrts at the top of the file hierarchy, instead of drive V: but I'm sure that can be fixed too.

Will report back with Linux results for those who care (like me) or are curious.

Thank you once again, doublemax.

Re: Large wxFileDialog

Posted: Fri Feb 02, 2018 3:52 pm
by Tony0945
Yes, it works on Linux (wxGTK-3.0.2)! In fact it looks much better on Linux than windows. It may be my desktop theme but the directories are in blue and the files are in red. On Windows both are black. On Windows the buttons are skinny rectangular and it's hard to see the icons. On Linux, the buttons are square and the icons are distinct.

Since my intended target is Raspberry Pi, I'm only interested in the Linux. Was developing on Windows as a convenience.

Many many thanks.