Announcement

Collapse
No announcement yet.

Is there a pop-up already done for file/folder select?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Doug Ingram
    replied
    Originally posted by Michael Mattias View Post
    There is no elevator to success; you must climb the stairs.

    And that quote is no help at all.

    I'm climbing my own stairs. I just asked for help on how to do a few procedures that I'm not familiar with - and offered to pay for the help.

    Thanks Mel and Jerry.

    Leave a comment:


  • Michael Mattias
    replied
    I've lost hours upon hours trying to get these calls and I'm sure it's more simple than what I'm trying.
    There is no elevator to success; you must climb the stairs.

    Leave a comment:


  • Jerry Fielden
    replied
    Hello Doug;

    I added to that example that was used before a few months ago since it is using Graphics. Maybe it will help you, but I'm not very expert at any of this stuff. I'm using a Sub to call both Save and Open.

    You can use PBCC Dir$ function to get that volume label and the Window API to get the Save and Open dialog boxes.

    The Dialogs is an easy way to get the Path and filenames for saving or opening and it puts it in a string. You still have to write the code for saving and Opening, the same code you always use when you save and open files.


    Code:
    #COMPILE EXE
    #DIM ALL
    #INCLUDE "C:\PBCC40\WINAPI\WIN32API.INC"
    #INCLUDE "C:\PBCC40\WINAPI\comdlg32.inc"
    GLOBAL hGwin AS DWORD
    
     SUB OpenSaveFile (OpenSave AS LONG, fName AS STRING)
    
         LOCAL ofn AS OPENFILENAME, results AS LONG   ', hGWIN AS LONG
         LOCAL Nul AS STRING, fn AS ASCIIZ * 2048, filter AS STRING
    
    
         Nul = CHR$(0)                                  'Make it shorter
         filter = "All Files (*.*)" + Nul + "*.*" + Nul + _
                  "Text Documents (*.txt)" + Nul + "*.txt" + Nul + _
                  "Basic Files (*.bas)" + Nul + "*.bas" + Nul + Nul
    
         ofn.lStructSize = SIZEOF(ofn)
         ofn.nMaxFile    = 2048
         ofn.hwndOwner   = hGWin
         ofn.lpstrFile   = VARPTR(fn)
         ofn.lpstrfilter = STRPTR(filter)
         ofn.Flags = %OFN_PATHMUSTEXIST OR %OFN_FILEMUSTEXIST OR %OFN_EXPLORER
    
         IF OpenSave THEN
            results = GetOpenFileName (ofn)           'Opens if OpenSave = 1
         ELSE
            results = GetSaveFileName (ofn)           'Saves if OpenSave = 0
         END IF
    
         fName = fn
     END SUB
    
    
    
    FUNCTION PBMAIN () AS LONG
      LOCAL NewCaption AS ASCIIZ * 40
     ' LOCAL hGWin AS DWORD
      LOCAL t AS STRING, FileNam AS STRING, VolLabel AS STRING
    
    
    
      GRAPHIC WINDOW "Undraw test...",0,0,800,600 TO hgwin
      GRAPHIC ATTACH hGWin, 0, REDRAW
      NewCaption = "Howdy Folks"
      SetWindowText(hgWin, NewCaption)
    
    
      GRAPHIC SET POS (200,300)
      GRAPHIC PRINT "Now is the time for all good men to come to the aid of their country"
      GRAPHIC SET POS (200,340)
      GRAPHIC PRINT "The quick red fox jumped over the lazy dogs back many times."
      GRAPHIC SET POS (200,380)
      GRAPHIC PRINT "Now is the time for all good men to come to the aid of their country"
      GRAPHIC REDRAW
      SLEEP 3000
    
      GRAPHIC SET MIX %MIX_NOTXORSRC
      GRAPHIC LINE (200,200)-(600,500)
      GRAPHIC REDRAW
      SLEEP 4000
    
      GRAPHIC LINE (200,200)-(600,500)
      GRAPHIC REDRAW
    
      ' restore the default mode...
      GRAPHIC SET MIX %MIX_COPYSRC
    
       OpenSaveFile 1, FileNam     ' 1 will cause it to open a file
       'Here's where you write your regular open file code using FileNam
       GRAPHIC SET POS (200,420)
       GRAPHIC PRINT FileNam    ' print the filename and path you clicked on
       GRAPHIC REDRAW
       
       
       SLEEP 4000
    
       OpenSaveFile 0, FileNam     ' 0 will cause it to SAVE
       'Here's where you write your regular Save file code using FileNam
       GRAPHIC SET POS (200,460)
       GRAPHIC PRINT FileNam   ' print the filename  and path you clicked on
       GRAPHIC REDRAW
       
       
       VolLabel = DIR$("C:\*.*", %VLABEL)
       GRAPHIC SET POS (200,490)
       GRAPHIC PRINT VolLabel
       GRAPHIC REDRAW
    
      GRAPHIC SET FOCUS
    
      NewCaption = "Goodbye Friends"
      SetWindowText(hgWin, NewCaption)
    
      SLEEP 6000
    
    
      GRAPHIC WINDOW END
    
    END FUNCTION

    Leave a comment:


  • Doug Ingram
    replied
    I will submit and admit to having little kung fu with API calls, etc.

    That said... I need specifics as to how to call an "open folder" "get file" in PBCC.

    I also need to read the drive volume label.

    Hints aren't getting me done here. I suppose once I understand the protocol better, it won't be an issue.

    For the volume label (and the other), I need simple - no nonsense - stuff I can cut and paste.

    the include
    the declare
    ---inside PBMAIN
    the call
    and the retrieval of the name (volume label - file name - folder - etc.)
    ---end PBMAIN

    If need be, I will pay for each routine.

    My program is coming along nicely, but I admit there are things I just don't get (yet).
    I've lost hours upon hours trying to get these calls and I'm sure it's more simple than what I'm trying.

    I've also tried the searches and found threads, but I'm not getting there on these issues.

    Thanks in advance... HELP!!!!!!!!!

    Leave a comment:


  • Michael Mattias
    replied
    COMDLG32.INC, in WInAPI folder installed with PB/CC.

    Leave a comment:


  • Mel Bishop
    replied
    Can't remember where I got these routines, but...
    Code:
    Select a file
    txt = "Message in title bar"
        OpenFileDialog(0, txt, FileName, PATH, txt + "|*.mdf|All Files|*.*", "txt", 0)
    Select a folder
    Code:
    REM *******************
    REM * Select a folder *
    REM *******************
    
    FUNCTION BrowseForFolder(hWndOwner AS LONG, sPrompt AS STRING) AS STRING
     LOCAL lpIDList AS LONG, szPath AS ASCIIZ * %MAX_PATH, udtBI AS BrowseInfo
     udtBI.hWndOwner = hWndOwner
     udtBI.lpszTitle = STRPTR(sPrompt)
     udtBI.ulFlags   = %BIF_RETURNONLYFSDIRS
     lpIDList = SHBrowseForFolder(udtBI)
     IF lpIDList THEN
       SHGetPathFromIDList BYVAL lpIDList, szPath
       CoTaskMemFree lpIDList
       FUNCTION = szPath
     END IF
    END FUNCTION

    Leave a comment:


  • Is there a pop-up already done for file/folder select?

    I'm using PBCC501 in Graphic Window mode.

    I'm wondering if there is existing code or a DLL that would allow me to select a folder or a file.
    It just needs to be similar to a small window screen that Excel, Word, or any program would pop-up to allow loading or saving a file.

    (If it's a DLL, a few hints on calling it from PBCC would be appreciated.)

    Thanks in advance. My program is ROCKING!!!

    Can I attach a few screen shots here?

    Doug
Working...
X