Documentation for Win32lib v0.60.6
Table of Contents

Values

These are routines that let you inspect and alter the current value of a control.


This is usually a text value but also include checkboxes, progress bars, and scroll bars.

  • proc appendText( object pID, object pText )   Adds text to the end of a edit control.
  • func getCaption( integer id)    This returns any caption text associated with id
  • func getData( object id)    This returns any data value associated with id
  • func getNumber( object )    Get the numeric value of text from object.
  • func getSelectedText( object )    Get the selected text in object.
  • func getTabItem(integer id)   Used to get the current tabitem selected in a tabcontrol
  • func getText( object id)    Get the text in object.
  • func getValues( integer Context, sequence Ids)   Gets the values from one or more specified controls.
  • proc insertText( object pID, object pText )   Inserts text at the current caret (insersion point)
  • func isChecked( object id )    Gets the checked state of id.
  • proc setBitmap( integer Object, object Bitmap )    Assign an bitmap to Object.
  • proc setCheck( object id, checked flag )    Check or uncheck id.
  • proc setIcon( integer id, object icon )    Assign an icon to object.
  • proc setPixmap( pixmap, bitmap )    Assign a new value to a Pixmap.
  • proc setSelectedText( integer object, sequence text )    Replaces the selected text in object with text.
  • proc setText( object pID, object pText )    Set the text in pID control.
  • proc showMessage( sequence Message )    Displays Message in a Statusbar

    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    appendText
    ( object pID, object pText )

    Adds text to the end of a edit control.

    Category: Values

    Example:

          -- Adds some text to the end of the control.
           appendText( myedit, ">Ready\n" )
    

    See Also: getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getCaption
    ( integer id)

    This returns any caption text associated with id

    Returns: SEQUENCE: The caption text.

    Category: Values

    The type of controls that have caption text are windows, menus, labels, and buttons. Other controls will return "".

    Example:

          sequence ctext
          sequence clst
          clst = {Btn1, Btn2, MenuItem3, Radio1, Checkbox2}
          for i = 1 to length(ctext) do
              ctext[i] = ReplaceText(getCaption(clst[i]), "all", "some")
              setCaption(clst[i], ctext[i])
          end for
    

    See Also: appendText, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getData
    ( object id)

    This returns any data value associated with id

    Returns: SEQUENCE: The data as a text string.

    Category: Values

    Note that Menuitems, Radio, Checkbox and TriCheckbox controls return a single character string of "0", "1", or "2" for Unchecked, Checked, and Neither respectively.

    For statusbars and treeviews, id can be a 2-element sequence containing {ControlID, Panel#} to get the value of a specific sub-panel of the statusbar, or treeview item.

    For RichEdit controls, this returns the selected text only.

    For ListView controls, this returns a sequence that contains one element for each selected item in the ListView. Each element is itself a sequence that contains an string element for each column in the ListView.
    ListView example:

          sequence text
          text = getData(myListView)
          -- If two rows were selected then the returned value
          -- may look like this ...
      { { "Col 1 data", "Col 2 data", "Col 3 data", ...}, -- 1st selected row
        { "Col 1 data", "Col 2 data", "Col 3 data", ...}  -- 2nd selected row
      }
    

    For StatusBar controls, object can be a two-element sequence, the first is the control's id, and the second is the section of the status bar (this is zero-based). Also, this returns two-elements:
      [1] is the text,
      [2] is the rendering method.

    0
    The text is drawn with a border to appear lower than the plane of the window.
    SBT_NOBORDERS
    The text is drawn without borders.
    SBT_POPOUT
    The text is drawn with a border to appear higher than the plane of the window.
    SBT_RTLREADING
    The text will be displayed in the opposite direction to the text in the parent window.

    For /TreeView controls, id takes the form {TV, TVItemID}. Where TVItemID is the id returned by addTVItem(). To get the currently selected treeview item, use zero for the TVItemID.

    Example:

          sequence text
          text[i] = getData(EditFld1)
    

    See Also: appendText, getCaption, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getNumber
    ( object )

    Get the numeric value of text from object.

    Returns: Numeric value of the control's text/caption value.

    Category: Values

    This uses w32TextToNumber() function to do the conversion.
    If the text value cannot be converted to a numeric value, zero is return.

    Example:

          -- get the numeric value from TheTextEdit
          atom number
    

    number = getNumber( TheTextEdit )

    See Also: appendText, getCaption, getData, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getSelectedText
    ( object )

    Get the selected text in object.

    Returns: Selected text, or empty sequence if nothing is selected.

    Category: Values

    This only works with text edit controls.

    Example:

          -- get the selected text from TheTextEdit
          sequence text
    

    text = getSelectedText( TheTextEdit )

    See Also: appendText, getCaption, getData, getNumber, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getTabItem
    (integer id)

    Used to get the current tabitem selected in a tabcontrol

    Returns: The control ID of the current tabitem or 0

    Category: Values

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getText
    ( object id)

    Get the text in object.

    Returns: Text in id's caption or text area.

    Category: Values

    This returns the control's caption if it has one, otherwise it returns its value.

    See also: getCaption and getData

    Example:

          -- get the text from TheTextEdit
          sequence text
    

    text = getText( TheTextEdit ) tvtext = getText ( {myTreeView, itemid} ) tvselectedtext = getText ( {myTreeView, 0} ) -- get the contents of the second panel in the statusbar. sbtext = getText( {StatBar, 2})

    btnCaption = getText( myBtn )

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    getValues
    ( integer Context, sequence Ids)

    Gets the values from one or more specified controls.

    Returns: SEQUENCE: A list of values, in the same order as the controls in Ids

    Category: Values

    This gets the values for each of the controls specified in Ids. The controls can be specified as either a control ID (integer) or a control name.

    If your application has multiple controls with the same name, you can specify a context for this routine to limit the search to. This is usually the Window that the requested controls belong to.

    Example:

          sequence lValues
          lValues = getValues(CustWin, {"Name", "Address", "ZIP", "Telephone"})
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    insertText
    ( object pID, object pText )

    Inserts text at the current caret (insersion point)

    Category: Values

    Example:

          -- Adds some text to the end of the control.
           insertText( myedit, "\n(Ready)\n" )
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [func]
    isChecked
    ( object id )

    Gets the checked state of id.

    Returns: INTEGER: w32True or w32False

    Category: Values

    This can be used on MenuItems, ListView, TreeView, Radio, and Checkboxes.

    Note for TreeView, the id takes the form {id, item}

    Note for ListViews, the id normally takes to form {id, row}. But if you just use id, then the row with focus is examined.

    Example:

              integer flag
    

    -- is TheRadio1 checked? flag = isChecked( TheRadio1 ) -- Is row 3 checked. flag = isChecked ({myLV, 3})

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setBitmap
    ( integer Object, object Bitmap )

    Assign an bitmap to Object.

    Category: Values

    Object can be one of the following:

  • Bitmap
  • PictureButton
  • TogglePicture

    If Bitmap is a sequence, it will be assumed to be the name of an bitmap file, and Win32Lib will attempt to load the bitmap.

    Otherwise, bitmap is assumed to be the handle of a bitmap.

    Example:

              -- assign a bitmap to the picture button
               setBitmap( PictureButton1, "close.bmp" )
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setCheck, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setCheck
    ( object id, checked flag )

    Check or uncheck id.

    Category: Values

    This works for MenuItems and toggle controls such as Radio, CheckBox and ToggleButton, and for ListViews

    Note that id can be either a single control id or a list of control ids.

    Example:

          -- set a check on the SyntaxColoring option
           setCheck( SyntaxColoring, w32True )
           setCheck( {TBtn1, TBtn2, TBtn3}, w32False)
    

    Note: For ListViews, the id is actually in the form {{id,row}} so it knows which row to check. Take note of the double sequence syntax.

          -- Add a check mark to row 2.
           setCheck( {{myLV, 2}}, w32True)
    

    Note If id is a menu item which has been defined as being in a menu item group (/defineMenuItemGroup), this routine turns on that menu item. This routine ensures that only one item from a menu radio group will be marked. Any that were previously marked will be 'turned off'

    Example:

          -- set the current loudness level.
           defineMenuRadioGroup({miPianissimo, miPiano, piModerato,
                                 miForte, miFortissimo})
          . . .
           setCheck( miForte, w32True)
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setIcon, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setIcon
    ( integer id, object icon )

    Assign an icon to object.

    Category: Values

    id can be one of the following:

  • Window
  • Icon
  • PictureButton
  • TogglePicture

    icon can represent a file name, a handle to an icon, or a predefined system icon code.

    To use an icon handle, you need to first get the handle using some other method (eg loadIconFromFile) and pass it to this routine as a sequence that only contains the handle. For example: {hIcon}

    To use a system icon, you need to specify one of the names:

    To use an icon from a file, just supply the file name. This can be a ICO, EXE, or DLL file. However, this will only fetch the first icon in that file. Some icon files can contain multiple icons. To use one of the other icons in a multi-icon file, you need to use the syntax {filename, icon#}. The icon# is the number of the icon to use. The first icno is 1, the second is 2, etc...

    Example:

          -- assign an icon to the window
          setIcon( TheWindow, "euphoria.ico" )
    

    -- assign the third icon to a button setIcon( pBtnStop, {"applib.ico", 3} )

    -- Use a icon handle hIcon = loadIconFromFile({"applib.ico", 2}) setIcon( pBtnGo, {hIcon})

    -- Use a system icon setIcon( bBtnErr, IDI_ERROR )

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setPixmap, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setPixmap
    ( pixmap, bitmap )

    Assign a new value to a Pixmap.

    Category: Values

    If bitmap is a sequence, it will be assumed to be the name of an bitmap file, and Win32Lib will attempt to load the bitmap.

    Otherwise, bitmap is assumed to be the handle of a bitmap.

    Example:

              -- assign a bitmap to the picture button
               setPixmap( Pixmap1, "spaceship.bmp" )
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setSelectedText, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setSelectedText
    ( integer object, sequence text )

    Replaces the selected text in object with text.

    Category: Values

    This only works with edit text controls.

    Example:

          -- add HTML formatting to the selected text
           text = getSelectedText( TheMle )
           setSelectedText( TheMle, "<I>" & text & "</I>" )
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    setText
    ( object pID, object pText )

    Set the text in pID control.

    Category: Values

    If the control is editable, it updated the data in the control. Otherwise, it updates the caption text of the control.
    For StatusBar controls, the pID can also be used to specify the subField to use. It takes the form of a 2-element sequence {id, subfield}.

    Example:

          -- change the caption of status bar
           setText( TheStatusBar, "Ready" )
          -- If a statusbar has subfields, you can specify
          -- them like:
          setText( {TheStatusBar,2}, "2nd subField")
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, showMessage


    Documentation for Win32lib v0.60.6
    Table of Contents

    [proc]
    showMessage
    ( sequence Message )

    Displays Message in a Statusbar

    Category: Values

    pText is the text string which is displayed in the first (or only) panel of the status bar which is on the main window.

    It is possible to display it on a different status bar by using the format { Message, pID }, where pID is either a Window id, which has a status bar, or an actual status bar control id.
    If you wish to display the message in a panel other than the first panel, the pID has the format {id, panel#}

    In any case, if the pID is zero, the application's main window is assumed.

    Example:

          -- Show the caption of status bar in the main window
          showMessage( "Ready" )
          -- To display a message in another window:
          showMessage( {"Searching...", EditWindow} )
          -- If the statusbar has subfields, you can specify them like:
          showMessage( {"2nd subField", {EditWindow,2}} )
    

    See Also: appendText, getCaption, getData, getNumber, getSelectedText, getTabItem, getText, getValues, insertText, isChecked, setBitmap, setCheck, setIcon, setPixmap, setSelectedText, setText