Engineering

Expand all | Collapse all

DOORS - DXL Script to clear the DXL Output window

  • 1.  DOORS - DXL Script to clear the DXL Output window

    Posted Fri May 15, 2020 03:35 PM
    Dear group members,

    Hope all of you are safe.

    Is it possible to clear the text from the DXL Output window using DXL scripting?

    Thanks and Regards,
    Jitesh

    ------------------------------
    Jitesh Patel
    ------------------------------


  • 2.  RE: DOORS - DXL Script to clear the DXL Output window

    Posted 3 days ago

    Hi !!

    You should avoid the DXL prompt panel... 

    If the messages you need to delete are from the error handle system, you should use the noError instruction more ... 

    And if you need to print some infos ... then you should use any other way to display your messages ;)

    Please considere this snippet as an example:

    // * ---------------------------------------------------------
    // -- Log box
    // * ---------------------------------------------------------
    DB global_logBox = null
    DBE global_logTextDbe = null
    Buffer global_logBuf = null
    // * ---------------------------------------------------------
    // combine -> but without memory leak == no string involved
    void combine ( Buffer b, string s ) {
        if (null b || null s) return
        Buffer tmp = create
        tmp = s; combine ( b, tmp, 0 )
        delete tmp
    }
    
    void combine ( string s, Buffer b ) {
        if (null b || null s) return
        Buffer tmp = create
        tmp = s; combine ( tmp, tempStringOf b, 0 )
        delete b
        b = tmp
    }
    // * ---------------------------------------------------------
    // log -> no print
    void log(string m) {
        if (null global_logBuf) global_logBuf = create()
        combine(global_logBuf, m)
        if (null global_logBox) {
           global_logBox = create("Log", styleCentered|styleFloating)
           global_logTextDbe = text(global_logBox, "", "", 400, 200, true)
           global_logTextDbe->"top"->"form"
           global_logTextDbe->"right"->"form"
           global_logTextDbe->"left"->"form"
           global_logTextDbe->"bottom"->"form"
           void close_log_(DB d) {
               if ( !null global_logBox) { delete(global_logBuf) }
               global_logBox = null
               global_logTextDbe = null
               hide d; destroy d
           }
           void clear_log_(DB d) {
               setempty global_logBuf
               set(global_logTextDbe,global_logBuf)
           }
           close(global_logBox,true,close_log_)
           apply(global_logBox,"Clear",clear_log_)
           realize global_logBox
        }
        set(global_logTextDbe,global_logBuf)
    }

    Now you can use the log function instead of the print function... I let you try it.

    Have fun !



    ------------------------------
    steeve rodriguez
    ------------------------------