Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » FileSel&FileList, Path » Button OK label in SaveAs dialog
Button OK label in SaveAs dialog [message #8071] Tue, 06 February 2007 06:30 Go to next message
andrei-catalin is currently offline  andrei-catalin
Messages: 62
Registered: May 2006
Location: Romania
Member
When SaveAs dialog is called first time, Button OK label is "Open". And when select a folder is "Save".

To improve this situation I've made few modifications in source code:

void FileSel::FileUpdate() {
	if(mode == SELECTDIR) {
		ok.Enable(!IsNull(~dir));
		return;
	}
	bool b = list.IsCursor() || !String(file).IsEmpty();
	ok.Enable(b);
	ok.SetLabel(t_("Open"));
//first modification
	if(mode == SAVEAS &&	   
	(list.IsCursor() && list[list.GetCursor()].isdir))
		ok.SetLabel(t_("Open"));
	else ok.SetLabel(t_("Save"));		
}


and

bool FileSel::ExecuteSaveAs(const char *title) {
	Title(title ? title : t_("Save as"));
//second modification
	ok.SetLabel(t_("Save"));
	return Execute(SAVEAS);
}


I am not sure that's the best solution.

Andrei
Re: Button OK label in SaveAs dialog [message #8092 is a reply to message #8071] Tue, 06 February 2007 23:41 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thanks, applied, I have just simplified first one to:

void FileSel::FileUpdate() {
	if(mode == SELECTDIR) {
		ok.Enable(!IsNull(~dir));
		return;
	}
	bool b = list.IsCursor() || !String(file).IsEmpty();
	ok.Enable(b);
	if(mode != SAVEAS || list.IsCursor() && list[list.GetCursor()].isdir)
		ok.SetLabel(t_("Open"));
	else
		ok.SetLabel(t_("Save"));		
}


Mirek
Re: Button OK label in SaveAs dialog [message #8105 is a reply to message #8092] Thu, 08 February 2007 06:08 Go to previous message
andrei-catalin is currently offline  andrei-catalin
Messages: 62
Registered: May 2006
Location: Romania
Member
The behavior of SaveAs dialog was improved but a strange situation may appear yet (tested in AdressBook). If a directory was selected and then I type the filename to save, button OK label remains "Open" (although it's action is SAVE).

if(mode != SAVEAS || list.HasFocus() && list.IsCursor() && list[list.GetCursor()].isdir)


improves the situation but not eliminates it (if nothing is typing on file box it appears again).

Andrei
Previous Topic: Get Files in a directory
Next Topic: How to select Directory
Goto Forum:
  


Current Time: Fri Mar 29 16:23:55 CET 2024

Total time taken to generate the page: 0.01192 seconds