Re: Tabs in FXTextField

Roland Hughes via Foxgui-users <[email protected]> Sun, 21 Apr 2024 07:51:17 -0500
Newsgroups gmane.comp.lib.fox-toolkit.user
Message-ID <[email protected]>
The Web documentation is very very sparse and I don't use FOX right now 
but I would look into these


FXbool 	pasteSelection 
<http://www.fox-toolkit.org/ref/classFX_1_1FXTextField.html#a15cb534a3e4dd86e02f923f93f7b5777>(FXbool 
notify=false)
	Paste primary selection.
FXbool 	pasteClipboard 
<http://www.fox-toolkit.org/ref/classFX_1_1FXTextField.html#a20781ca175da2ef7a10c03a0cd167419>(FXbool 
notify=false)
	Paste clipboard.

long 	*onClipboardLost*(FXObject 
<http://www.fox-toolkit.org/ref/classFX_1_1FXObject.html>*, FXSelector, 
void *)
long 	*onClipboardGained*(FXObject 
<http://www.fox-toolkit.org/ref/classFX_1_1FXObject.html>*, FXSelector, 
void *)
long 	*onClipboardRequest*(FXObject 
<http://www.fox-toolkit.org/ref/classFX_1_1FXObject.html>*, FXSelector, 
void *)


    Detailed Description

A text field is a single-line text entry widget.

The text field widget supports clipboard for cut-and-paste operations. 
Text input may be constrained to a certain format; the built-in 
capabilities support integer and real number entry constraints; 
additional constraints on the input may be implemented by intercepting 
the SEL_VERIFY message; a custom handler should examine the tentative 
input string passed as type const FXchar* in the message data, and 
return a value of "0" if the new input is accepted. During text entry, 
the text field sends a SEL_CHANGED message to its target, with the 
message data set to the current text value of type const FXchar*. When 
the text is accepted by hitting ENTER, the SEL_COMMAND message is sent. 
The text field also sends SEL_COMMAND when the focus moves to another 
control. TEXTFIELD_ENTER_ONLY can be passed to suppress this feature. 
Typically, this flag is used in dialogs that close when ENTER is hit in 
a text field.


----

Basically, speaking in a Qt/CopperSpice/signal-slot manner:

You are looking for what would be an aboutToPaste() signal from the 
field. Something emitted/called when the field is about to accept a 
paste. You then feed the text through "filter" code of your own 
substituting N-spaces for \t characters.

Ah, here: http://fox-toolkit.org/clipboard.html

Detailed documentation on the clipboard as it exists in Fox. You should 
be able to find where to wedge your filter in there.

You probably also want to beg for a "feature" of 
preClipboardPasteFilter() or a similar name, which makes a local copy of 
the clipboard content, applies one or more filters, then passes the 
bytes through to the paste operation itself.

On 4/21/2024 6:40 AM, Enno Rehling wrote:
> I accidentally only replied to Jeroen earlier, so here's my question 
> again, to the whole list:
>
> In this case, the way the tabs got into this field was via copy & 
> paste. Is there a good way to catch that and remove the tabs?
>
> Enno.
>
> On 4/7/2024 4:51 PM, Jeroen van der Zijp wrote:
>> On Sat, 6 Apr 2024 19:33:42 +0200
>> Enno Rehling <[email protected]> wrote:
>>
>>> I have a FXTextField in my application, and when I insert text into 
>>> it that
>>> starts one or more leading tab characters, the rendering of the text 
>>> goes
>>> haywire:
>>> [image: fox_text.png]
>>> The text that it's trying to display is "<tab><tab>Lorem ipsum dolor 
>>> sit
>>> amet, consectetur adipiscing elit" - notice the white space at the end
>>> followed by another t, and the weird artifacts in "adipiscing" that 
>>> make
>>> the word unreadable.
>>> This artifacting gets word when I move the text cursor backwards 
>>> through
>>> the text:
>>
>> Interesting.  The reason I don't think I've seen this is because
>> there's no way to enter a tab into FXTextField.  Or any control 
>> character,
>> for that matter. So text drawing in FXTextField has no "substitute" 
>> characters
>> to render the way FXText does.
>>
>> Maybe this is something that should be fixed, or at very least, 
>> protected against.
>>
>>
>>   -- JVZ
>>
>>
>
>
> _______________________________________________
> Foxgui-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/foxgui-users

-- 
Roland Hughes, President
Logikal Solutions
(630)-205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog


-- 
This email has been checked for viruses by Avast antivirus software.
www.avast.com

_______________________________________________
Foxgui-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/foxgui-users