hmmm - bug or not?

Just starting out? Need help? Post your questions and find answers here.
User avatar
kpeters58
Enthusiast
Enthusiast
Posts: 341
Joined: Tue Nov 22, 2011 5:11 pm
Location: Kelowna, BC, Canada

hmmm - bug or not?

Post by kpeters58 »

Only tested with editor - other gadgets are probably affected as well.

If you set an editor gadget's font to bold and paste some non-bolded text into it, the text does not get converted to bold, but stays normal or italic (or whatever it was).

Opinions?
PB 5.73 on Windows 10 & OS X High Sierra
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: hmmm - bug or not?

Post by Josh »

The text you insert has the formatting of the text you copied. A normal behavior for the EditorGadget.
sorry for my bad english
RobertSF
User
User
Posts: 61
Joined: Thu May 03, 2018 4:24 pm

Re: hmmm - bug or not?

Post by RobertSF »

It's a behavior I see in Microsoft products. It can be annoying, but I can see why the behavior is as it is.

It's annoying when, for example, you try to copy something from a web page into a Word document. Now your Word document is full of crap, javascript, css, or whatever was formatting the text you copied. In Word, what you do is Paste Special, Text Only. If I'm working in an application that doesn't have that feature, like Outlook, I paste what I copied from the web page into Notepad. That strips all the crap out of it, and then I can copy and paste that into wherever.

But the behavior makes sense. Formatting belongs to the text it formats, I guess.
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: hmmm - bug or not?

Post by gurj »

I seem to remember that there are APIs that can set gadget to use text or RTF formats...
my pb for chinese:
http://ataorj.ys168.com
User avatar
Shardik
Addict
Addict
Posts: 2060
Joined: Thu Apr 21, 2005 2:38 pm
Location: Germany

Re: hmmm - bug or not?

Post by Shardik »

For Windows RASHAD has already demonstrated here how to paste RTF text or plain text into the EditorGadget.
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: hmmm - bug or not?

Post by gurj »

thanks Shardik! for lnk.
my pb for chinese:
http://ataorj.ys168.com
User avatar
skywalk
Addict
Addict
Posts: 4221
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: hmmm - bug or not?

Post by skywalk »

This is a feature. To paste without formatting, use [Ctrl+Shift+V].
And/or code that into your app's.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
User avatar
gurj
Enthusiast
Enthusiast
Posts: 693
Joined: Thu Jan 22, 2009 3:48 am
Location: china
Contact:

Re: hmmm - bug or not?

Post by gurj »

on my PC, WinXP x86
[Ctrl+Shift+V]=[Ctrl+V].
my pb for chinese:
http://ataorj.ys168.com
User avatar
blueb
Addict
Addict
Posts: 1116
Joined: Sat Apr 26, 2003 2:15 pm
Location: Cuernavaca, Mexico

Re: hmmm - bug or not?

Post by blueb »

I've used this method in my IDE 'Tools' menu for a couple of years, and it works well on Win 10 x64 machine.

viewtopic.php?p=484177#p484177
- It was too lonely at the top.

System : PB 6.21(x64) and Win 11 Pro (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: hmmm - bug or not?

Post by Marc56us »

kpeters58 wrote:If you set an editor gadget's font to bold and paste some non-bolded text into it, the text does not get converted to bold, but stays normal or italic (or whatever it was).
Adds a button (Paste) or personal keyboard shortcut and uses SetGadgetText(#Gadget, GetClipboardText()) instead of CTRL+V The original (pasted) format will be deleted and will take the format defined by the gadget. This also removes all RTF formatting.

or remove format after paste

Code: Select all

Procedure Drop_Format()
    SetClipboardText(GetGadgetText(#Gadget))
    SetGadgetText(#Gadget, GetClipboardText())
    ClearClipboard()
EndProcedure
The text will be replaced and will have the format originally defined by the gadget.

:wink:
Post Reply