Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resize Common Dialog

Status
Not open for further replies.

andy0923

Programmer
Jul 26, 2002
65
0
0
US
Has anyione had any luck in resizing Common Dialog?

Ive gotten as far as noting the property OFN_ENABLESIZING but dont know how to apply it? Any help would be appreciated
 
Ive gotten as far as noting the property OFN_ENABLESIZING but dont know how to apply it? Any help would be appreciated

AFAIK, the common dialog is resizeable by default.

This is one of the values for the flags property of the control. The flags property controls the appearance and the behavior of the dialog. This is similar to the DialogBoxType parameter in the native VFP MESSAGEBOX() function: the values of the flags are additive.

Marcia G. Akins
 
Andy,

In addition to what Marcia said ... If you are putting the actual constant (OFN_ENABLESIZING) in your code, you will need to have a #DEFINE for it somewhere. Or, use its numeric value, which is 0xH800000.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
Thanks for your responses. I figured it might be additive. Might anyone have a short code example?

I am using the foxpro Common Dialog Box Foundation Class example I don't see the property listed, either how to set it or how to add on to it.

As for resizeable being the default, thats how I remember it and when I just looked it, for some strange reason its not.
 
Code:
*-- Class:        acxcommondialog (e:\marciapresents\activex\libs\activex.vcx)
*-- ParentClass:  olecontrol
*-- OLEObject = C:\WINDOWS\system32\comdlg32.ocx
*
Define Class acxcommondialog As OleControl

  Height = 37
  Width = 36
  *-- The folder from which the file(s) were selected
  cpath = (Fullpath( Curdir() ))
  *-- Caption for the open file dialog
  ccaption = "Select one or more files"
  *-- Default file extension to use if the user types something in the box that does not have an extension
  cextension = ""
  *-- The list of selected files from the dialog
  cselectedfiles = ""
  *-- Types of files to display such as Tables | *.dbf
  cfilter = ""
  Name = "acxcommondialog"


  *-- sets the required flags, displays the dialog and parses the return values
  Procedure getfiles
    #Define cdlOFNReadOnly  1  && Checks Read Only check box for Open and Save As dialog boxes.
    #Define cdlOFNOverwritePrompt  2  && Generates a message box if the selected file already exists.
    #Define cdlOFNHideReadOnly  4  && Hides the Read Only check box.
    #Define cdlOFNNoChangeDir  8  && Sets the current directory to what it was when the dialog box was invoked.
    #Define cdlOFNHelpButton  16  && Causes the dialog box to display the Help button.
    #Define cdlOFNNoValidate  256  && Allows invalid characters in the returned file name.
    #Define cdlOFNAllowMultiselect  512  && Allows the File Name list box to have multiple selections.
    #Define cdlOFNExtensionDifferent  1024  && Extension of returned file name is different from the one set by DefaultExt.
    #Define cdlOFNPathMustExist  2048  && User can enter only valid path names.
    #Define cdlOFNFileMustExist  4096  && User can enter only names of existing files.
    #Define cdlOFNCreatePrompt  8192  && Asks if the user wants to create a file that does not currently exist.
    #Define cdlOFNShareAware  16384  && Sharing violation errors will be ignored.
    #Define cdlOFNNoReadOnlyReturn  32768  && The returned file will not have the Read Only attribute set.
    #Define cdlOFNNoLongNames  262144  && No long filenames.
    #Define cdlOFNExplorer  524288  && Windows 95 Open A File dialog box template.
    #Define cdlOFNNoDereferenceLinks  1048576  && No shortcuts.
    #Define cdlOFNLongNames  2097152  && Long filenames.

    Local lcCurDir, lnFlags, lcFiles, lnI
    *** Save the current directory
    lcCurDir = Fullpath( Curdir() )
    *** Set the required flags
    *** This demo uses the common dialog to allow users to select
    *** multiple files. You could easily modify this class to be totally
    *** configurable and use it for all your getfile() and putfile() dialogs
    *** simply by adding properties for each of thes configurable options
    *** and setting the flags depending on their values
    lnFlags = cdlOFNExplorer +;
      cdlOFNHideReadOnly +;
      cdlOFNAllowMultiselect  +;
      cdlOFNPathMustExist +;
      cdlOFNFileMustExist
    With This
      .Flags = lnFlags
      .DialogTitle = .ccaption
      .Defaultext = .cextension
      .InitDir = .cpath
      .Filter = .cfilter
      If Not Empty( .Filter )
        .FilterIndex = 1
      Endif
      *** Display the dialog
      .ShowOpen()
      *** If multiple files were selected, .FileName consists of the path followed by a
      *** separator followed by the list of files selected separated by separators. If
      *** only one file was selected, .FileName is the complete path to the file.
      lcFiles = .FileName
      *** Individual files are separated with .NULLS.
      *** so if we have any in the string returned
      *** we know that we have more than one file
      If Chr( 0 ) $ lcFiles
        *** But we have to replace all the nulls with
        *** another character because GETWORDNUM() does
        *** not see nulls as separators - do not use a space
        *** in case there are spaces in file or folder names
        lcFiles = Strtran( lcFiles, Chr( 0 ), [~], 1, -1, 1 )
        .cpath = Getwordnum( lcFiles, 1, [~] )
      Else
        .cpath = Addbs( Justpath( lcFiles ) )
      Endif
      lcFiles = Alltrim( Strtran( lcFiles, .cpath, [], 1, 1, 1 ) )
      .cselectedfiles = []
      For lnI = 1 To Getwordcount( lcFiles, [~])
        .cselectedfiles = .cselectedfiles + Addbs( .cpath ) + Getwordnum( lcFiles, lnI, [~] ) + Chr( 13 ) + Chr( 10 )
      Endfor
    Endwith
    *** restore current directory
    Cd ( lcCurDir )
  Endproc


Enddefine

Marcia G. Akins
 
andy9023

As Marcia's sample shows, you need to define the flags you are going to use, and add the all up into a string and pass that value in the Flags property of the control. For example you could use something like:
Code:
#DEFINE OFN_HIDEREADONLY            4
#DEFINE cdOFNNOCHANGEDIR             8
#DEFINE cdOFNEXTENSIONDIFFERENT   1024
#DEFINE cdOFNPATHMUSTEXIST        2048 && 0x800
#DEFINE cdOFNCREATEPROMPT         8192 && 0x2000
#DEFINE cdOFNEXPLORER           524288 && 0x80000
#DEFINE cdOFNDONTADDTORECENT  33554432 && 0x2000000
#DEFINE cdOFNENABLESIZING     0x800000
lnFlags = cdOFNPATHMUSTEXIST + cdOFNEXTENSIONDIFFERENT +;
	cdOFNCREATEPROMPT + cdOFNHIDEREADONLY + cdOFNNOCHANGEDIR+ cdOFNENABLESIZING

Now you can use the variable lnFlags and pass it trough Marcia's sample code.




Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
ReFox XI (www.mcrgsoftware.com)
 
This is a lot more "grown up" then the foundation class example given for foxpro help. Cant wait to get to work on this.

Thanks so much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top