Bay Six Software Forum Index Bay Six Software
Beyond the Basics
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A "Save As" FileDialog without "Save"
Liberty BASIC 3 and 4 give you the ability to determine which type of file dialog is displayed, Open or Save As. Before LB 3, only the Open dialog was available. The Save As is preferable for saving a file mostly for aesthetic reasons. (Although LB does not, most applications will have the Save As dialog tell the user he/she is about to overwrite an existing file.)

What if you want a Save As dialog, but you want the title to read "Create New File"? To answer this, you need to know that Windows almost always uses C-type null-terminated strings. On the other hand, LB almost never cares which characters are in a string because, as is common in BASIC, LB stores the length with the string itself.

Therefore the trick is to use a null character or Chr$(0) to terminate the text that shows and follow that with the word "Save."

FileDialog "Create New File"+Chr$(0)+"Save", "*.*", file$

Powered by phpBB © 2001, 2005 phpBB Group