"Save As" dialog box
"Save As" dialog box
Hi,
I need to simulate the "Save As" dialog box. How can I do this ?
I need to simulate the "Save As" dialog box. How can I do this ?
Re: "Save As" dialog box
I didn't quite understand what you meant. See if this example helps, or explain better, Please.
No entendí muy bien lo que querías decir. Vea si este ejemplo ayuda o explica mejor, por favor.
https://forums.fivetechsupport.com/view ... 04&start=0
Regards, saludos.
No entendí muy bien lo que querías decir. Vea si este ejemplo ayuda o explica mejor, por favor.
https://forums.fivetechsupport.com/view ... 04&start=0
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
- Antonio Linares
- Site Admin
- Posts: 42273
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: "Save As" dialog box
Dear Yuri,
cFile := cGetFile32( "Prg Source (.prg) |.prg|", FWString( "Save as" ), 0, cPath, .T., .T. )
thanks to Cristobal
cFile := cGetFile32( "Prg Source (.prg) |.prg|", FWString( "Save as" ), 0, cPath, .T., .T. )
thanks to Cristobal
Re: "Save As" dialog box
Thanks !
Is it possible to create a folder selection dialog with the condition that files are visible (files themselves cannot be selected) ?
Is it possible to create a folder selection dialog with the condition that files are visible (files themselves cannot be selected) ?
Re: "Save As" dialog box
Explique mejor, PLS.
https://forums.fivetechsupport.com/view ... 1f#p219403
Regards, saludos.
https://forums.fivetechsupport.com/view ... 1f#p219403
Code: Select all | Expand
// C:\FWH\SAMPLES\SAVEAS.PRG
#include "FiveWin.ch"
static oWnd
//----------------------------------------------------------------//
FUNCTION Main()
local oBar
DEFINE WINDOW oWnd TITLE "SALVAR COMO" // save as
DEFINE BUTTONBAR oBar _3D OF oWnd
DEFINE BUTTON OF oBar ACTION SALVAR_COMO()
SET MESSAGE OF oWnd TO "SALVAR COMO" NOINSET CLOCK DATE KEYBOARD
ACTIVATE WINDOW oWnd
RETURN NIL
FUNCTION SALVAR_COMO()
LOCAL cFile
/*
cFile := cGetFile32( , FWString("Save as"), 0, ;
hb_CurDrive() + ":\" + CurDir(), .T., .T. )
*/
cGetFile32( '*.TXT| *.TXT', "Save as", 0, 'c:\temp' , .T., .T. )
RETURN NIL
// FIN / END
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: "Save As" dialog box
And here is cGetFile32, I need to select a folder ?
Re: "Save As" dialog box
maybe:Natter wrote:And here is cGetFile32, I need to select a folder ?
https://forums.fivetechsupport.com/view ... 04&start=0
Regards, saludos.
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: "Save As" dialog box
This option allows you to select either a folder or a file.
I need something similar, but without the option to select a file (folder files should be inactive)
Code: Select all | Expand
#define BIF_NONEWFOLDERBUTTON 0x0200
#define BIF_RETURNONLYFSDIRS 0x0001
#define BIF_DONTGOBELOWDOMAIN 0x0002
#define BIF_STATUSTEXT 0x0004
#define BIF_RETURNFSANCESTORS 0x0008
#define BIF_EDITBOX 0x0010
#define BIF_VALIDATE 0x0020
#define BIF_NEWDIALOGSTYLE 0x0040
#define BIF_USENEWUI (BIF_NEWDIALOGSTYLE|BIF_EDITBOX)
#define BIF_BROWSEINCLUDEURLS 0x0080
#define BIF_BROWSEFORCOMPUTER 0x1000
#define BIF_BROWSEFORPRINTER 0x2000
#define BIF_BROWSEINCLUDEFILES 0x4000
#define BIF_SHAREABLE 0x8000
itm:=cGetDir( OemToAnsi("Select folder or file"),,,, ;
BIF_RETURNONLYFSDIRS + BIF_DONTGOBELOWDOMAIN + BIF_USENEWUI + ;
BIF_BROWSEINCLUDEFILES, .T. )
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: "Save As" dialog box
Is this not what you are looking for?
Code: Select all | Expand
cDir := cGetDir( cTitle, [cInitDir] )
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: "Save As" dialog box
cGetDir( cTitle, [cInitDir] ) shows only folders without files. I need the files of the folder to be visible, but without the possibility of selection
Re: "Save As" dialog box
If it's just to show the files, isn't it better to do it this way?
Si es solo para mostrar los archivos ¿no es mejor hacerlo así?
Regards, saludos.
Si es solo para mostrar los archivos ¿no es mejor hacerlo así?
Code: Select all | Expand
#include "FiveWin.Ch"
#include "Directry.ch"
#define CLR_LGREEN nRGB( 190, 215, 190 )
#define CLR_LGRAY nRGB( 230, 230, 230 )
#define CLR_VERMELHO nRGB( 255, 000, 000 )
#define CLR_AMARELO nRGB( 255, 255, 000 )
REQUEST OrdKeyNo, OrdKeyCount, OrdCreate, OrdKeyGoto
STATIC nBytes, nDisks
STATIC lnKeyEscape := .F.
FUNCTION Main()
LOCAL oSetupDlg, nDriveTo := 1, cDriveTo, nDriveCap := 4
LOCAL lGoOn, aFiles[ 1 ], aFileList, x, iDcor, oFont, oBackup
LOCAL oDlg, oBrw, n := 1
LOCAL oAceitar, oCancelar, nKey := VK_RETURN
LOCAL aDbfs := Directory( "*.DBF" )
// LOCAL aDbfs := DirectoryRecurse( "C:\FWH1701\*.*" )
// LOCAL aDbfs := DirectoryRecurse( "*.DBF" )
SET CENTURY ON
SET DATE BRITISH
SET TIME FORMAT TO "HH:MM:SS"
SET EPOCH TO Year( Date() ) - 30
SET SOFTSEEK OFF
SET WRAP ON
SetCancel( .F. )
SET CONFIRM OFF
SET DELETED ON
SET _3DLOOK ON
SET UNIQUE OFF
SET ESCAPE OFF
SET EXACT ON // CONTROLA O :=, = e ==
SET EXCLUSIVE OFF
SET MULTIPLE OFF
IF Len( aDbfs ) < 1
RETURN NIL
ENDIF
// aSort( aDbfs, , , { |x, y | x[1] < y[1] } )
ASort( aDbfs )
DEFINE FONT oFont NAME "Arial" SIZE 0, 16 BOLD
DEFINE DIALOG oDlg FROM 6, 20 TO 25, 90 ;
TITLE "Browse dos Arquivos DBFs em: " + ;
CurDir() + " Para Visualizar" ;
STYLE nOR( WS_BORDER, WS_THICKFRAME ) ;
COLORS CLR_BLACK, nRGB( 193, 205, 205 )
@ 1, 2 LISTBOX oBrw FIELDS aDbfs[ n ][ 1 ], ;
Str( aDbfs[ n ][ 2 ], 10, 0 ), ;
DToC( aDbfs[ n ][ 3 ] ), ;
aDbfs[ n ][ 4 ] ;
Headers "Nome do Arquivo", ;
"Tamanho", "Data", "Hora" ;
FieldSizes 270, 80, 80, 60 ;
COLOR CLR_HBLUE, CLR_AMARELO ;
FONT oFont ;
Of oDlg Size 260, 100
oBrw:bGotop := {|| N := 1 }
oBrw:bGoBottom := {|| N := Eval( oBrw:bLogicLen ) }
oBrw:bSkip := {| nWant, nOld | nOld := N, N += nWant, ;
N := Max( 1, Min( N, Eval( oBrw:bLogicLen ) ) ), ;
N - nOld }
oBrw:bLogicLen := {|| Len( aDbfs ) }
oBrw:cAlias := "Array"
oBrw:nClrBackHead := CLR_LGREEN
oBrw:nClrBackFocus := CLR_HRED
oBrw:nClrForeFocus := CLR_AMARELO
oBrw:nClrForeHead := CLR_HRED
oBrw:nColAct := 1
oBrw:nLineStyle := 3
oBrw:lCellStyle := .T.
oBrw:aJustify := { .F., .F., .F., .F. }
oBrw:lMChange := .F.
oBrw:SetFocus()
oBrw:Refresh()
@ 6.6, 20 Button oBackup PROMPT "&Exit" Of oDlg ;
ACTION( oDlg:End() ) SIZE 40, 12 CANCEL
ACTIVATE DIALOG oDlg CENTERED
oFont:End()
RETURN NIL
// FIN / END
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: "Save As" dialog box
I can do that, but you're too lazy. I looked at everything BIF flags - except for BIF_BROWSEINCLUDEFILES there is nothing. I decided to stop there
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: "Save As" dialog box
First attempt, using ShellAPI function SHBrowseForFolder()
Needs improvement with the guidance of masters.
The problem still remains. User can select a normal File also, even though the flag BIF_RETURNONLYFSDIRS is set when the flag BIF_BROWSEINCLUDEFILES is added.
Expecting experts to guide.
Needs improvement with the guidance of masters.
Code: Select all | Expand
#include "fivewin.ch"
function Main()
? "start"
? shbrwfolders( "c:\fwh" )
? "done"
return nil
#pragma BEGINDUMP
#include <windows.h>
#include <shlobj.h>
#include <stdio.h>
#include <hbapi.h>
#include <fwh.h>
HB_FUNC( SHBRWFOLDERS ) // ( cInitDir ) --> cSelectedFolder
{
LPITEMIDLIST pidl;
PIDLIST_ABSOLUTE pDir;
// Set up BROWSEINFO structure
BROWSEINFO bi = { 0 };
bi.hwndOwner = NULL; // Set to your application's main window if available
bi.pidlRoot = NULL; // Set to a specific folder to start from, if desired
bi.pszDisplayName = NULL;
bi.lpszTitle = "Select a Folder";
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_NEWDIALOGSTYLE | BIF_BROWSEINCLUDEFILES ; // Flags for dialog options
// Initialize COM library
CoInitialize(NULL);
if ( HB_ISCHAR( 1 ) ) {
if ( SHParseDisplayName( fw_parWide( 1 ), NULL, &pDir, 0, NULL) == S_OK ) {
bi.pidlRoot = pDir;
}
}
// Display the Browse for Folder dialog
pidl = SHBrowseForFolder(&bi);
// Check if a folder was selected
if (pidl != NULL) {
// Get the path of the selected folder
char path[MAX_PATH];
if (SHGetPathFromIDList(pidl, path)) {
hb_retc( path );
} else {
hb_retc( "" );
}
// Free the ITEMIDLIST
CoTaskMemFree(pidl);
} else {
hb_retc( "" );
}
// Uninitialize COM library
CoUninitialize();
}
The problem still remains. User can select a normal File also, even though the flag BIF_RETURNONLYFSDIRS is set when the flag BIF_BROWSEINCLUDEFILES is added.
Expecting experts to guide.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India
Re: "Save As" dialog box
hi,
you can test if it is a File or Folder which are selectnageswaragunupudi wrote:The problem still remains. User can select a normal File also, even though the flag BIF_RETURNONLYFSDIRS is set when the flag BIF_BROWSEINCLUDEFILES is added.
greeting,
Jimmy
Jimmy
- nageswaragunupudi
- Posts: 10691
- Joined: Sun Nov 19, 2006 5:22 am
- Location: India
- Contact:
Re: "Save As" dialog box
Yes, this is only a workaround.you can test if it is a File or Folder which are select
Mr. Natter expects that the user should not be able to select a file. In other words, the OK button to be grayed out so that the user can not select if the cursor is on a file, but can select only when the cursor is on a folder.
For this we need to use VALID with a callback function.
I expect some experts can do that.
Regards
G. N. Rao.
Hyderabad, India
G. N. Rao.
Hyderabad, India