Ignore:
Timestamp:
Jan 23, 2013, 1:14:00 AM (13 years ago)
Author:
Alex Taylor
Message:

Add NLS support functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/shared/PrintUtl.VRS

    r14 r19  
    339339
    340340
     341/*:VRX         CreatePrinterObject
     342*/
     343/* Create the specified printer using SysCreateObject (this should create the
     344 * queue automatically).
     345 */
     346CreatePrinterObject: PROCEDURE
     347    PARSE ARG driver, model, portname, queuename, printername
     348
     349    oid = '<WPPO_'queuename'>'
     350    setup = 'PORTNAME='portname';PRINTDRIVER='driver'.'model';QUEUENAME='queuename';TAKEDEFAULTS=YES'
     351
     352    rc = SysCreateObject('WPPrinter', printername, '<WP_DESKTOP>', setup';OBJECTID='oid';', 'F')
     353    IF rc == 1 THEN
     354        CALL SysMoveObject oid, '<WP_PRINTERSFOLDER>'
     355    ELSE
     356        rc = SysCreateObject('WPPrinter', printername, '<WP_DESKTOP>', setup';', 'F')
     357
     358RETURN rc
     359
     360
    341361/*:VRX         RSPCreatePort
    342362*/
     
    594614RETURN drv_list.0
    595615
     616/*:VRX         NLSGetMessage
     617*/
     618/*
     619 * Gets the message text associated with the given message number from the
     620 * current language file.
     621 */
     622NLSGetMessage: PROCEDURE EXPOSE globals.
     623    PARSE ARG msgnum, .
     624    args = ARG()
     625
     626    msgfile = globals.!messages
     627    IF msgnum == '' THEN RETURN ''
     628
     629    sub_parms = ''
     630    DO i = 2 TO args
     631        sub_parms = sub_parms', "'ARG( i )'"'
     632    END
     633
     634    INTERPRET 'msgfromfile = SysGetMessage( msgnum, msgfile' sub_parms ')'
     635
     636    PARSE VAR msgfromfile message '0D'x .
     637    IF SUBSTR( message, 1, 4 ) == 'SYS0' THEN message = ''
     638
     639RETURN message
     640
     641/*:VRX         NLSSetText
     642*/
     643/*
     644 * Sets the specified property of the specified control to the specified
     645 * message text.
     646 */
     647NLSSetText: PROCEDURE EXPOSE globals.
     648    PARSE ARG control, property, message, substitution
     649    args = ARG()
     650
     651    success = 1
     652    IF args < 4 THEN
     653        text = NLSGetMessage( message )
     654    ELSE DO
     655        sub_parms = ''
     656        DO i = 4 TO args
     657            sub_parms = sub_parms '"'|| ARG( i ) ||'",'
     658        END
     659        sub_parms = STRIP( sub_parms, 'T', ',')
     660        INTERPRET 'text = NLSGetMessage( message, 'sub_parms')'
     661    END
     662
     663    IF text == '' THEN success = 0
     664    ELSE               CALL VRSet control, property, text
     665
     666RETURN success
     667
Note: See TracChangeset for help on using the changeset viewer.