Wide Studio Object Reference

| Wide Studio Object Reference |
Wide Studio Home
Up to
  ## Class Name WSCtextField ## Specification of methods ### getTextFrame method Form WSCbase* getTextFrame() Function Returns the internal instance which provides multi-line text input field ( the class:WSCvmifield). Description Parameters None. Return value Returns the internal instance. Notice Samples
        //get the internal WSCvifield instance.
        WSCbase* ifield = newtext_000->getTextFrame();
  ### addString method Form void addString(char* var) Function Adds the specified string to the input text. Description Parameters
  (in)char* var | The string

Return value
  None.
Notice
  If you want to replace the string, use the property WSClabelString.
Samples

        //add string.
        newtext_000->addString("add string");

  ### getBuf method

  Form
    WSCushort* getBuf()
  Function
    Returns the internal text input buffer.
  Description
  Parameters
    None.
  Return value
    Returns the internal buffer.
  Notice
    Do not delete the buffer. It becomes invalid when the buffer is changed by the keyboard input, so it is better that you copy the return buffer to another. The text is UCS2 code.
  Samples

          //get internal UCS2 text buffer.
          WSCushort* buf = newtext_000->getBuf();

  ### onActivate method

  Form
    void onActivate()
  Function
    It executes this method when scrolling is done.
  Description
    Instead of the event procedure by the WSEV_ACTIVATE trigger, the WSEV_ACTIVATE event can be handled by overloading of this method.
  Parameters
    None.
  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onActivate(){
          //do something when scrolling is done.

          //call the method of the parent class.
          old_class::onActivate();
        }

  ### onValueChange method

  Form
    void onValueChanged()
  Function
    It executes this method when the input text is changed.
  Description
    Instead of the event procedure by the WSEV_VALUE_CH trigger, the WSEV_VALUE_CH event can be handled by overloading of this method.
  Parameters
    None.
  Return value
    None.
  Notice
    If needed, overload this method on the sub classes.
  Samples

        void new_class::onValueChange(){
          //do something when the value is changed.

          //call the method of the parent class.
          old_class::onValueChange();
        }

  ### onKey() method

  Form
    void onKey(WSDkeyboard* keyboard,WSCbool keydown);
  Function
    It executes this method when the key is pressed and released.
  Description
    Instead of the event procedure by the WSEV_KEY_PRESS/RELEASE trigger, the WSEV_KEY_PRESS/RELEASE event can be handled by overloading of this method.
  Parameters

    (in)WSDkeyboard* keyboard | Keyboard instance
    (in)WSCbool keydown | True = Press,False = Release

  Return value
    None.
  Notice
  Samples

        void new_class::onKey(WSDkeyboard* keyboard,WSCbool keydown){
          //a key is pressed.
          if (keydown != False){
            //get key.
            long key = keyboard->getKey();
            //get input text.
            WSCstring str = keyboard->getText();
          }

          //call the method of the parent class.
          old_class::onKey(keyboard,keydown);
        }

  ### onKeyHook() method

  Form
    void onKeyHook(WSDkeyboard* keyboard);
  Function
    It executes this method to hook the input key.
  Description
    Instead of the event procedure by the WSEV_KEY_HOOK trigger, the WSEV_KEY_HOOK event can be handled by overloading of this method.
  Parameters

    (in)WSDkeyboard* keyboard | Keyboard instance

  Return value
    None.
  Notice
  Samples

        void new_class::onKeyHook(WSDkeyboard* keyboard){
          //get the input text.
          WSCstring str = keyboard->getText();
          //It is possible to
          //replace the text with keyboard->setText(...)

          //call the method of the parent class.
          old_class::onKey(keyboard,keydown);
        }

  ### replaceSelectedString() method

  Form
    void replaceSelectedString(char* str,long encoding = WS_EN_DEFAULT);
  Function
    Replace the selected string.
  Description
  Parameters

    (in)char* str | New string to replace
    (in)long encoding | Encoding of a new string

    Default encoding is WS_EN_DEFAULT. Refer to WSCstring(char*,long) about available encoding.
  Return value
    None.
  Notice
  Samples

          //replace the selected string with the specified string.
          newtext_000->replaceSelectedString("replace string");

  ### getSelectedString() method

  Form
    WSCstring getSelectedString()
  Function
    Returns the selected string.
  Description
  Parameters
    None.
  Return value
    Returns the selected string.
  Notice
  Samples

          //get the selected string.
          WSCstring stext = newtext_000->getSelectedString();

  ### getString() method

  Form
    WSCstring getString()
  Function
    Returns the input string.
  Description
  Parameters
    None.
  Return value
    Returns the input string.
  Notice
  Samples

          //get the input string.
          WSCstring text = newtext_000->getString();

  ### deleteSelectedString() method

  Form
    void deleteSelectedString()
  Function
    Deletes the selected string.
  Description
  Parameters
    None.
  Return value
  Notice
  Samples

          //delete the selected string.
          newtext_000->deleteSelectedString();

  ### setSelect() method

  Form
    long setSelect(long pos, long len)
  Function
    Make the selected string.
  Description
    Make a string of specified position and selected length.
  Parameters

    (in)long pos | Start position of the selected string
    (in)long len | Length of the selected string

  Return value
    Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
  Notice
  Samples

          //make the string selected from beginning to the fifth character.
          newtext_000->setSelectedString(0,5);

  ### getSelectedPos() method

  Form
    long setSelectedPos()
  Function
    Returns the position of the selected string.
  Description
  Parameters
    None.
  Return value
    Returns the position of the selected string.
  Notice
  Samples

          //get the position of the selected string.
          long pos = newtext_000->setSelectedPos();

  ### getLines() method

  Form
    long setLines()
  Function
    Returns the lines of the string.
  Description
  Parameters
    None.
  Return value
    Returns the lines.
  Notice
  Samples

          //get the lines of the strring.
          long pos = newtext_000->getLines();

  ### getTopLine() method

  Form
    long getTopLine()
  Function
    Returns the top-most line number of the string being displayed.
  Description
  Parameters
    None.
  Return value
    Returns the top-most line number.
  Notice
  Samples

          //get the top-most line number.
          long pos = newtext_000->getTopLine();

  ### setTopLine() method

  Form
    long setTopLine(long line)
  Function
    Specify the top-most line number.
  Description
    Make the specified line to top-most line under displayed.
  Parameters

    (in)long line | the line(0,1,2...)

  Return value
    Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
  Notice
  Samples

          //scroll and make the eleventh line the top-most line.
          newtext_000->setTopLine(10);

  ### getBottomLine() method

  Form
    long getBottomLine()
  Function
    Returns the bottom-most line number of the string being displayed.
  Description
  Parameters
    None.
  Return value
    Returns the bottom-most line number.
  Notice
  Samples

          //get the bottom-most line number.
          long line = newtext_000->getBottomLine();

  ### setBottomLine() method

  Form
    long setBottomLine(long line)
  Function
    Specify the bottom-most line number.
  Description
    Make the specified line the bottom-most line being displayed.
  Parameters

    (in)long line | the line(0,1,2...)

  Return value
    Returns WS_NO_ERR if it succeeds, returns WS_ERR if not.
  Notice
  Samples

          //scroll and make the eleventh line the bottom-most line.
          newtext_000->setBottomLine(10);

  Document Release 3.20
  For use with Wide Studio Release 3.20, Spring 2003

  Wide Studio Home | Up to

  Copyright(C) T. Hirabayashi, 1999-2003 |  | Last modified: February 3, 2003