hiCreateMLTextField only shows one line at a time

Discussion in 'Cadence' started by David, Nov 21, 2003.

  1. David

    David Guest

    I am trying to use a MLText device to show the status of the program
    as it proceeds through its flow but only one line shows and gets
    overwritten rather than creating a newline.
    If I type into the device from the keyboard, it behaves as expected.
    As soon as the program writes to it, all the previous data is
    replaced by a single line. I was hoping to eventually use this
    to display running results from an external program.

    This is the device: ***********************************************
    startList =
    append( startList
    list(
    list( hiCreateMLTextField(
    ?name 'startMLText1
    ;;;?prompt "Messages"
    ?value ""
    ?defValue ""
    ;;;[?font t_font]
    ?hasVerticalScrollbar t
    ?hasHorizontalScrollbar t
    ?enableWordWrap t
    ?editable t
    ?enabled t
    ;;;[?callback t_callback]
    ;;;[?changeCB t_changeCB]
    ;;;[?nextField g_nextField]
    ) startXOS-90:423 462:100 50
    )
    ) ;;; end list list
    ) ;;; end append

    This is a call to it : ***********************************************

    if( isDir( plotDir ) == nil
    then
    printStartMsg( sprintf(nil, "Creating %s \n", plotDir
    ) )
    createDir( plotDir )
    else
    printStartMsg( sprintf(nil, "%s already created \n",
    plotDir ) )
    ) ;;; end if isDir

    This the routine to write it :
    ***********************************************

    procedure(
    printStartMsg( str1 ) (

    prog ( msg )

    oldValue = BP_StartForm->startMLText1->lastValue
    msg = concat( str1 oldValue )
    BP_StartForm->startMLText1->value = msg

    ) ;;; end printStartMsg
    ) ;;; end procedure

    Any help with this?

    David
     
    David, Nov 21, 2003
    #1
  2. David

    suresh j Guest

    David,
    I modified the code. Check if this is what you want.

    If the message size goes large, I suggest you go for appending a unix
    file and opening it in the cadence file viewer with autoUpdate ON.

    ;This is the device: ***********************************************
    startMLText1 = list( hiCreateMLTextField(
    ?name 'startMLText1
    ;;;?prompt "Messages"
    ?value ""
    ?defValue ""
    ;;;[?font t_font]
    ?hasVerticalScrollbar t
    ?hasHorizontalScrollbar t
    ?enableWordWrap t
    ?editable t
    ?enabled t
    ;;;[?callback t_callback]
    ;;;[?changeCB t_changeCB]
    ;;;[?nextField g_nextField]
    ) 5:5 462:100 50
    )

    ;This is a call to it : ***********************************************

    if( isDir( "/tmp/tmp" ) == nil
    then
    printStartMsg( sprintf(nil, "Creating %s \n", "/tmp/tmp") )
    createDir( "/tmp/tmp" )
    else
    printStartMsg( sprintf(nil, "%s already created \n",
    "/tmp/tmp" ) )
    ) ;;; end if isDir

    ;This the routine to write it :
    ;***********************************************

    procedure( printStartMsg(str1)
    prog(
    (
    msg
    )

    oldValue = BP_StartForm->startMLText1->value
    msg = sprintf(nil, "%s\n%s" oldValue str1)
    BP_StartForm->startMLText1->value = msg
    );prog
    );procedure

    BP_StartForm = hiCreateAppForm(
    ?name 'BP_StartForm
    ?fields list(
    startMLText1
    )
    )

    hiDisplayForm(BP_StartForm)



    ;************************************************************************************************
     
    suresh j, Nov 21, 2003
    #2
  3. David

    David Guest

    Thank you, Suresh!!
    This solution works very well :)
    David

     
    David, Nov 21, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.