Routine for Viewing a file... 
Author Message
 Routine for Viewing a file...

I am looking for a VX-REXX or other PM routing that can be called from
VX-REXX that will simply view a file.  I have seen other Install programs
do this for viewing a readme file.  It's a window with scroll bars that
allows you to view the file.  I know I could use e.exe, and will if I
have to, but the files being viewed will be log files that should not be
updated.
djs.
--
                                                         __
  Darwin Sanoy                                          / / __
                                                     __/ / /_/ ____
  Sometimes one pays most for the things            /   / __  / __/
  one gets for nothing. - Albert Einstein          / / / / / /_  /
  ______________________________________________  /___/ / / /___/

                                                    /___/


Tue, 15 Jul 1997 01:49:46 GMT  
 Routine for Viewing a file...
:I am looking for a VX-REXX or other PM routing that can be called from
:VX-REXX that will simply view a file.  

Perhaps the following VX-REXX code (a VRX file) might help.

Barry Nance
   author, "Using OS/2 Warp", "Introduction to Networking",
   "Client/Server LAN Programming", "Networking Windows for Workgroups",
   and "Connecting with LAN Server".
-------------------------------------------------------------------
/*:VRX         Main
*/
/*  Main
*/
Main:
/*  Process the arguments.
    Get the parent window.
*/
    parse source . calledAs .
    parent = ""
    argCount = arg()
    argOff = 0
    if( calledAs \= "COMMAND" )then do
        if argCount >= 1 then do
            parent = arg(1)
            argCount = argCount - 1
            argOff = 1
        end
    end
    InitArgs.0 = argCount
    if( argCount > 0 )then do i = 1 to argCount
        InitArgs.i = arg( i + argOff )
    end
    drop calledAs argCount argOff

/*  Load the windows
*/
    call VRInit
    parse source . . spec
    _VREPrimaryWindowPath = ,
        VRParseFileName( spec, "dpn" ) || ".VRW"
    _VREPrimaryWindow = ,
        VRLoad( parent, _VREPrimaryWindowPath )
    drop parent spec
    if( _VREPrimaryWindow == "" )then do
        call VRMessage "", "Cannot load window:" VRError(), ,
            "Error!"
        _VREReturnValue = 32000
        signal _VRELeaveMain
    end

/*  Process events
*/
    call Init
    signal on halt
    do while( \ VRGet( _VREPrimaryWindow, "Shutdown" ) )
        _VREEvent = VREvent()
        interpret _VREEvent
    end
_VREHalt:
    _VREReturnValue = Fini()
    call VRDestroy _VREPrimaryWindow
_VRELeaveMain:
    call VRFini
exit _VREReturnValue

VRLoadSecondary: procedure
    name = arg( 1 )

    window = VRLoad( VRWindow(), VRWindowPath(), name )
    call VRMethod window, "CenterWindow"
    call VRSet window, "Visible", 1
    call VRMethod window, "Activate"
return window

/*:VRX         Fini
*/
Fini:
    window = VRWindow()
    call VRSet window, "Visible", 0
    drop window
return 0

/*:VRX         Halt
*/
Halt:
    signal _VREHalt
return

/*:VRX         Init
*/
Init:
    window = VRWindow()
    call VRMethod window, "CenterWindow"
    call VRSet window, "Visible", 1
    call VRMethod window, "Activate"
    drop window
return

/*:VRX         M_COPYID_Click
*/
M_COPYID_Click:

    TransferData = VRGet("TextMLE", "SelectedText")
    button.0 = 1
    button.1 = "Ok"
    rc = VRMessage(VRWindow(), "Please use Ctrl-Ins", "Copy to ClipBoard",
"I", "button.", 1)

    return

/*:VRX         M_HELPID_Click
*/
M_HELPID_Click:

    button.0 = 1
    button.1 = "Ok"
    rc = VRMessage(VRWindow(), "There's no help.", "Help", "I", "button.", 1)
    return

/*:VRX         M_OPENID_Click
*/
M_OPENID_Click:
    filespec = VRFileDialog(VRWindow(), "Open File", "O")
    if filespec = "" then do
        return
        end
    call ReadFile
    return

ReadFile:
    button.0 = 1
    button.1 = "Ok"
    Buffer = ""
    CRLF   = "0d0a"x

/*
    rc = VRMessage(VRWindow(), "Look for >" || filespec || "<", "Test",
"I", "button.")
*/

    exists = VRFileExists(filespec)
    if exists = 0 then do
        rc = VRMessage(VRWindow(), "File " || filespec || " not found.",
"Open", "E", "button.")
        return
        end

    call VRSet VRWindow(), "StatusArea", "Bottom"
    call VRSet VRWindow(), "StatusText", "Please wait..."
    do forever
        if Lines(filespec) = 0 then do
            leave
            end
        Buffer = Buffer || LineIn(filespec) || CRLF
        end

    call VRSet "TextMLE", "Value", Buffer
    call VRSet VRWindow(), "StatusArea", "Bottom"
    call VRSet VRWindow(), "StatusText", " "
    call VRSet VRWindow(), "Caption", "Text File Viewer (" || filespec || ")"
    return
/*:VRX         M_QUITID_Click
*/
M_QUITID_Click:

    call VRSet VRWindow(), "ShutDown", 1

    return

/*:VRX         M_SELECTALLID_Click
*/
M_SELECTALLID_Click:

    last = Length(Buffer)
    call VRSet "TextMLE", "SelectedStart", 1
    call VRSet "TextMLE", "SelectedEnd", last + 1
    return

/*:VRX         Quit
*/
Quit:
    window = VRWindow()
    call VRSet window, "Shutdown", 1
    drop window
return

/*:VRX         Win1_Close
*/
Win1_Close:
    call Quit
return

/*:VRX         Win1_Create
*/
Win1_Create:

    if InitArgs.0 < 1 then do
        return
        end

    if InitArgs.1 = "" then do
        return
        end

    filespec = InitArgs.1
    call ReadFile

return

/*:VRX         Win1_Resize
*/
Win1_Resize:

    window = VRWindow()
    width  = VRGet(window, "InteriorWidth") - 20
    height = VRGet(window, "InteriorHeight") - 50

    call VRSet "TextMLE", "Width", width
    call VRSet "TextMLE", "Height", height

return



Tue, 15 Jul 1997 03:53:32 GMT  
 Routine for Viewing a file...

Quote:

>I am looking for a VX-REXX or other PM routing that can be called from
>VX-REXX that will simply view a file.

Why do you need a routine?  There is an object, the MultiLineEntryField,
that does this job.

 Paul Prescod



Wed, 16 Jul 1997 05:25:54 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Viewing (or *not* viewing) .wrl files with NS3.0b5

2. Load .wrl Files, View it, centered in View

3. Need a JPG viewing Routine

4. Contract verification view of a routine?

5. Contract verification view of a routine?

6. File I/O Operations on Secondary VIEW(ed) Files

7. Using files from Robolab pilot as seed files for inventor level or lab view

8. .WRL files viewed as ZIP files

9. Assembly routine to use a crack on any file, as %1 in a batch file

10. WANTED: FORTRAN ROUTINE TO COVERT RAW FILES INTO GIF FILES

11. No bind on variable View (801) attempting ot open the currewnt view

12. Controller/View question (dealing with view bounds)

 

 
Powered by phpBB® Forum Software