Using Browse command in VFP9

I used FPW2.6 untill a month ago , since then I convert most of my old programs to VFP9 , all is working fine except one major problem I have , the Browse command is not working in an stand alone EXE program , I know I can use the grid option but still the browse command was an easy way to display records in a file, is there a way to use the browse command in an EXE file

Thank's for help


Answer this question

Using Browse command in VFP9

  • KevinP

    Thank's , I don't have , as I wrote before I put in a form a command buttun , when clicking on this command it should open a browse screen with the selected file.

    Is there additional code that should be written

    Thank's

  • prawin

    Thank's for your answer , the real problem is I m using a form windows "as top-level form" this meens that after creating an EXE file the form opens without VFP main window. I put a command buttun "Browse" & in the click mhetod I select the file to be used & wrote the next command "browse fields myfld1, myfld2 ".

    in the design time area it's working fine but after creating an EXE file by build win32 excutable the command buttun is doing nothing when clicking on it.

    Thank's

  • Rory Plaire

    No.
    A simple:
    browse
    or
    browse < browse clauses here >
    work for me very well (though I only use browse for debugging purposes).

    BTW to display records at runtime you could still use a grid instead of a browse. ie:

    * A button click code
    local lcMyBrowse
    text to m.lcMyBrowse noshow
    oForm = createobject('myForm')
    oForm.Show

    define class myForm as form
      ShowWindow = 1
      WindowType = 1
      Height =  400
      Width = 600
      Caption = 'This is my browse'
     
      add object myGrid as Grid with Height = 400, Width = 600, recordsource = alias()
    enddefine
    endtext
    ExecScript(m.lcMyBrowse)

  • GTO

    Ah, important piece of information with the Top-Level form.

    You might want to try the IN WINDOW clause of the BROWSE. You can try defining a new form with the Top-Level attribute, or use the current Top-Level form.


  • Jmill07

    It definitely works, but I had to test it to be sure since it has been years since I have used BROWSE outside of the IDE.

    Could it be you have an error handler that is eating an error in the BROWSE statement How about posting some of the code which is not executing


  • Pabya

    Browse works with toplevel forms and doesn't need main screen nor 'in window' clause. Browse creates and shows in a window that's identical to toplevel form in size.

    Do you have a code to reproduce it


  • Kardath

    The code is located in a form command buttun in the click method :

    select mytable
    browse fields myfld1, myfld2


    that's all the code.

    Thank's

  • jcbrooks75

    What, exactly, "doesn't work".  I can't think of anything WRT the BROWSE command that works differently in versions > FPW2.6.

    Worst case scenario, you can turn your BROWSE into a BROWSE NAME, something like this:

    LOCAL lnRow, lnCol
    lnRow = INT(_Screen.Height/FONTMETRIC(1,_Screen.FontName,_Screen.FontSize,"N"))-2
    lnCol = INT(_Screen.Width/FONTMETRIC(6,_Screen.FontName,_Screen.FontSize,"N"))-1

    DEFINE WINDOW ForBrowse FROM 0,0 TO lnRow, lnCol ;
         FLOAT GROW CLOSE MINIMIZE ZOOM SYSTEM ;
         FONT "Tahoma",9

    PUBLIC oBrowse
    SELECT CursorToBrowse
    BROWSE NAME oBrowse NOWAIT NOAPPEND NODELETE NOEDIT WINDOW ForBrowse
    oBrowse.AutoFit()

    whereupon the oBrowse variable holds an object reference to your BROWSE, the big advantage being that you can update the oBrowse properties, along with the properties of its (Header, Column, etc.) members.  And message methods like the AutoFit(), as I did above.

    Drew Speedie
    VFP MVP


  • Using Browse command in VFP9