PCE version 4C man_modulenamespaceid_tablemodified current_idOIxN class/textN referenceC hash_tablerefersizeOIxNbothI&sNV.text.x_caretCman_variable_card identifiermodule last_modifiednamesummary descriptionsee_alsoinheritdefaultsOIxNV.text.x_caretRICdateOIx({ bNx_caretnCstringOIxbX-position of the caret in pixels. Used to avoid recomputing when the text has to be redisplayed.CchainsizeOIxIENV.text.y_caretXnnsNM.text.S.format_leftCman_method_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherit diagnosticsdefaultsbugsOIxNM.text.S.format_leftRIOIx,DzN format_leftnnnOI xIENM.text.S.format_centerXnnnsNM.text.S.initialiseOI xNM.text.S.initialiseRIOI x5}MN initialisenOI xCreate a text object from the specified string, format and font. The <-string defaults to '', the <-format to `left' and the <-font to the text.fontnnnnnsNM.text.S.eventOI xNM.text.S.eventRIOIx.NeventnOIxThe default event-handling for a text manipulates the visibility of the caret on focus events and invokes ->typed on itself if the event if a keyboard event and the <-show_caret yields @on. See also ->keyboard_focus.nnnnnsN V.text.caretOIxN V.text.caretRIOIx,DNcaretnOIxLocation of the caret (= insertion point). Zero indicates before the first character. Setting the ->caret to @default places the caret at the end of the text.OIxIENV.text.show_caretXnnsNM.text.S.computeOIxNM.text.S.computeRIOIx,D}hNcomputenOIx9Recomputes <-area from the <-string, <-font and <-margin.nnnnnsNM.text.S.pasteOIxNM.text.S.pasteRIOIx,DNpastenOIxFPaste value of the numbered X-cut-buffer. See `display <-cut_buffer'.nnnnnsNC.textCman_class_card identifiermodule last_modifiednamesummary descriptionsee_alsoinherituser_interfacebugsOIxNC.textRIOIxB [NtextnOIxClass text is used to display (short) text fragments on a graphical device object. The text may be printed in any font. It may span multiple lines (separated by newline-characters (ASCII value 10)), which may be aligned on their left-side, center or right-side. The current implementation silently truncates text objects that span more than 200 physical lines. Text objects can be boxed by setting their ->pen. Text objects provide limited editing capabilities which are compatible to the editing capabilities provided by class editor (EMACS oriented). Text objects are edited using the method ->typed. See also class text_item (text entry field), class view and class editor.OIxIeN $class/key_binding$C.key_bindingeNM.text.G.key_bindingeNM.text.S.typedeNR.text.key_bindingeN$class/editor$C.editoreN$class/string$C.stringeN$class/text_item$C.text_itemXnnnsNM.text.G.pointedOIxNM.text.G.pointedRIOIx,DNpointednOI xrReturns character index from a pixel-position relative to the top-left corner (origin) of the text. This method may be used to set the caret using the mouse: ?- new(T, text('Hello World')), send(T, show_caret, @on), send(T, recogniser, click_gesture(left, '', single, message(T, caret, ?(T, pointed, @event?position)))).OI!xIeNM.text.S.typedeNM.text.S.show_caretENM.text.S.caretXnnnnsNM.text.S.marginOI"xNM.text.S.marginRIOI#x0wNmarginnOI$xDefine how the text object handles long string. Text objects may handle long strings in three different ways as described by <-wrap: # extend (->margin: @nil). The graphical is as big as needed to display the string # clip (->margin: width, clip) The graphical has fixed width. If the string is too long it will be clipped. # wrap-1 (->margin: width, wrap) The graphical has a <-margin defined. If the string is too long to fit within the margin it will be wrapped on multiple physical lines. Wrapping only happens at word boundaries. # wrap-2 (->margin: width, wrap_fixed_width) Similar to `wrap-1', but the <-width of the graphical equals the margin rather than the width occupied by the displayed characters.OI%xIEN V.text.wrapXnnnnsN V.text.formatOI&xN V.text.formatRIOI'x0`+NformatnOI(xThe `format' describes how the lines of a text containing multiple lines are aligned and how the area of the text changes if the string or font is changed: # left The left-sides of the lines are aligned. It the text changes, the top-left corner is maintained. # center The lines are centered below each other, If the text changes, the center is maintained. #right The right-sides of the lines are aligned. It the text changes, the top-right corner is maintained.OI)xIEN$class/menu$V.menu.formatXnnsN V.text.stringOI*xN V.text.stringRIOI+x({ NstringnOI,xThe currently displayed string.nnnsN V.text.fontOI-xN V.text.fontRIOI.x0NfontnOI/xFont used to draw the text. There are no provisions for multiple fonts in text object. Note that class editor is capable of handing multiple fonts.OI0xIeN R.text.fontEN$class/font$C.fontXnOI1xResource defined.sNM.text.S.resizeOI2xNM.text.S.resizeRIOI3x*NresizennOI4xIEN%$class/graphical$M.graphical.S.resizeXnnnnsNV.text.x_offsetOI5xNV.text.x_offsetRIOI6x0Nx_offsetnOI7xtWhen <->length is specified (i.e. non-zero), this value indicates how many pixels at the left-side are not visible.OI8xIEN V.text.lengthXnnsNM.text.G.selected_textOI9xNM.text.G.selected_textRIOI:x?gN selected_textnOI;x.New string object with contents of <-selectionnnnnnsN R.text.fontCman_resource_card identifiermodule last_modifiednamesummary descriptionsee_alsoinheritdefaultsO IxIEN V.text.fontXnnsNR.text.key_bindingO I?xNR.text.key_bindingRIOI@x({ _N key_bindingnnOIAxIeNM.text.S.typedENC.textXnnsNM.text.S.format_centerOIBxNM.text.S.format_centerRIOICx,DN format_centernOIDxFormat the text centered, left or right. These methods are defined without arguments for invoking them easily from the keyboard.nnnnnsNV.text.show_caretOIExNV.text.show_caretRIOIFx,D^N show_caretnOIGxbIf @on, the caret (insertion-point) is displayed. See also `window ->keyboard_focus' and ->caret.OIHxIeN V.text.caretXnOIIx@offsNM.text.S.format_rightOIJxNM.text.S.format_rightRIOIKx,D|N format_rightnnnOILxIENM.text.S.format_centerXnnnsNM.text.S.has_send_methodOIMxNM.text.S.has_send_methodRIOINx;MpNhas_send_methodnOIOxTest whether the text object implements a method. Text accepts all methods of itself, of <-string and of class string. See also ->catch_all.nnnnnsNM.text.S.transparentOIPxNM.text.S.transparentRIOIQx?N transparentnOIRxCompatibilty method defining <-background. The value @on is equivalent to ->background: @nil and @off to ->background: @default.nnnnnsNV.text.backgroundOISxNV.text.backgroundRIOITx<N backgroundnOIUxDefines the background of the text. Allowed values are: @nil (transparent), @default (cleared to current background) or a colour object or a pixmap object. See also ->transparent.nnnsNM.text.S.show_caretOIVxNM.text.S.show_caretRIOIWx*ON show_caretnnOIXxIeNM.text.S.typedENM.text.G.pointedXnnnnsNM.text.S.backward_kill_wordOIYxNM.text.S.backward_kill_wordRIOIZx0Nbackward_kill_wordnOI[x*Deletes words backward from caret (\e DEL)nnnnnsN M.text.S.clipOI\xN M.text.S.clipRIOI]x* NclipnnOI^xIeN$class/font$M.font.G.widthEN V.text.clipXnnnnsN V.text.marginOI_xN V.text.marginRIOI`x,)NmarginnOIaxTogether with <-wrap, <-margin controls how long strings are represented by class text. These slots are manipulated by ->margin.nnnsNM.text.G.selectionOIbxNM.text.G.selectionRIOIcx?gN selectionnOIdxHNew point object with start and end of selection. See also ->selection.nnnnnsNV.text.y_caretOIexNV.text.y_caretRIOIfx({ Ny_caretnOIgxbY-position of the caret in pixels. Used to avoid recomputing when the text has to be redisplayed.OIhxIENV.text.x_caretXnnsNM.text.S.geometryOIixNM.text.S.geometryRIOIjx,DNgeometrynOIkxZJust moves the text object as the size is determined by the <-string, <-font and <-margin.nnnnnsNV.text.positionOIlxNV.text.positionRIOImx({ NpositionnOInxRemember the reference point for resizing the text if it's contents changes. Recomputing this point each time from the area would cause the text to `walk' due to rounding errors.nnnsNM.text.S.caretOIoxNM.text.S.caretRIOIpx*GNcaretnnOIqxIeNM.text.S.typedENM.text.G.pointedXnnnnsN V.text.wrapOIrxN V.text.wrapRIOIsx,)NwrapnOItxhDescribes whether long strings are displayed as-is, clipped or wrapped to multiple lines. See ->margin.OIuxIENM.text.S.marginXnnsNM.text.S.selectionOIvxNM.text.S.selectionRIOIwx?gSN selectionnOIxxMake [from, to) the selection. If `from' is @nil to must be omitted and the selection is cleared. Otherwise default values do not change the corresponding end of the selection. See also <-selected_text, class edit_text_gesture and the Prolog library(pce_editable_text).nnnnnsNM.text.S.lengthOIyxNM.text.S.lengthRIOIzx,DLNlengthnOI{xvSets the <-margin in the <-fonts `ex' units (see `font <-ex'). New code should use the more advanced ->margin method.nnnnnsNM.text.S.catch_allOI|xNM.text.S.catch_allRIOI}x;MpN catch_allnOI~xDelegate to <-string. In addition, if <-string does not accept the method, but class string does, the <-string is converted to a string object holding the same characters. See also ->has_send_method.nnnnnsNM.text.S.typedOIxNM.text.S.typedRIOIx,DRNtypednOIxHandle keyboard event. Class `text' does not provide default event-handling, but editable text objects are easily created by forwarding keyboard-events to this method: :- pce_global(@edit_text_recogniser, new(handler(keyboard, message(@receiver, typed, @arg1)))). text_make_editable(T) :- send(T, recogniser, @edit_text_recogniser). This method uses the key_binding object called `text' from @key_bindings to map the typed keys on selectors and then invokes methods on class text. With the above, if the user types control-U to the text the following happens: 1) Event arrives at text and is given to ->typed using @edit_text_recogniser. 2) The `event <-id' is processed by the `text' key_binding object and mapped on the selector `clear'. ->clear does not require arguments and the key_binding object just invokes `text->clear'. 3) ->clear erases all characters from the text.OIxIeNM.text.S.show_careteNM.text.S.careteNM.text.G.pointedeNR.text.key_bindingeNM.text.G.key_bindingeN$class/text_item$C.text_itemENC.textXnOIx1Fails if the keyboard event could not be handled.nnXaCnumber O Ixx