TextEditGadgetEx PB 4.60

Share your advanced PureBasic knowledge/code with the community.
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx edit mode added

Post by idle »

V 0.4b

Added input cursor return key and backspace

Can some one confirm if the marquee on the blue Gradient gadget is flickering on windows?
Start the marquee by right clicking.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: TextEditGadgetEx edit mode added

Post by Kwai chang caine »

Hello IDLE

Yes i have a little flikering sometime in the right blue panel :(
Nearly all the 1 second

And i have also a little flikering in the left board too
Sometime when i write character in it :(
ImageThe happiness is a road...
Not a destination
eesau
Enthusiast
Enthusiast
Posts: 589
Joined: Fri Apr 27, 2007 12:38 pm
Location: Finland

Re: TextEditGadgetEx edit mode added

Post by eesau »

I suppose the new CanvasGadget could be used for this to make it more robust and reduce the flickering.
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx edit mode added

Post by idle »

eesau wrote:I suppose the new CanvasGadget could be used for this to make it more robust and reduce the flickering.
Thanks I wasn't sure if the flickering was due to running window in a VM, should be easy enough to fix.

I've been thinking of giving the canvas gadget a try in 4.6b as I've bumped into some irritating behavioral differences between linux and windows
so the codes gotten a bit messy resorting to dirty fixes to facilitate the editor support.

@kcc
Thanks, it will be flickering on every update, I hadn't noticed it before.


The flickering is caused by the image being 32 bit format, so it just needs to be double buffered and copied into a 24 bit image and then set to the image gadget.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx edit mode added

Post by idle »

V 0.41b added dirty arrow keys for cursor navigation, fixed dispaly flicker windows.

It's gotten a little messy, will have to think about doing this properly rather than quick and dirty
I don't know if the key board input will work in other languages, should be ok on windows but I don't know about linux

since the image gadget won't trap input I've added a hidden dummy button on linux to trap input
on windows you just set the focus

Please let me know if there are any other bugs, I'll re factor the code once it's stable.
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: TextEditGadgetEx edit mode added

Post by Kwai chang caine »

Good news, no flikering on the right side :D

Bad news, i can't enter text in the left side :(
I clic, clic, and clic again, press keyboard, and after a moment the characters appears :shock:
An that, even if i not right clic on the right side

The head sentence move correctly, and if i move the mouse, the head sentence move very very faster, if i move the mouse out of the windows, the sentence move slower, remove inside the windows more faster, etc ...
ImageThe happiness is a road...
Not a destination
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx edit mode added

Post by idle »

I noticed a problem with the marquee, it's fixed now.
As for the editing if the cursor appears you can type, I can only test it on XP
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

v 0.5a

Added Auto gadget resizing, Scaling and Zoom, fixed the marquees

Drawing on windows still needs some attention, the font's look a bit jagged.

v 0.51a

Fixed return bug, trapped non print keys
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

v 0.52a

Added AltGtr support for international keyboards

Is still a bug with return key looking!
if you back space a line to a return it will screw up the display.

Please, I would like to get some feedback of how it works on Vista and Win7
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: TextEditGadgetEx resize scaling zoom

Post by TomS »

After clearing the left field and then typing I'll get an IMA at line 465: *this\cfont\name = *this\fonts[0]\name

PB 4.51 Win7 32

Also the marquee is a bit rough. The horizontal one seems like it's stopping every few moments for an instance and the vertical one is rather jumping than floating smoothly.
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

TomS wrote:After clearing the left field and then typing I'll get an IMA at line 465: *this\cfont\name = *this\fonts[0]\name

PB 4.51 Win7 32

Also the marquee is a bit rough. The horizontal one seems like it's stopping every few moments for an instance and the vertical one is rather jumping than floating smoothly.
Thanks for that

Fixed the clear bug.

Yes the marquee is a bit rough at the moment, I need to take another look at the drawing routines, I think they're eating to much CPU due to the alpha blending, also since the marquee are running off a window timer in the same thread it's kind of expected to get some jitters especially when both are running together.


something else you could try is to comment out the backbuffer, it's needed on Xp to avoid flickering but maybe not win7
and may be having an adverse effect with aero
line 727

Code: Select all

 ;CompilerIf  #PB_Compiler_OS = #PB_OS_Windows
 ;     StartDrawing(ImageOutput(*this\bufferedImg))
 ;     DrawImage(ImageID(*this\outputImg),0,0)
 ;     StopDrawing()
 ;     SetGadgetState(*this\Gadget,ImageID(*this\bufferedImg)) 
 ;   CompilerElse
      SetGadgetState(*this\Gadget,ImageID(*this\outputimg))
 ;  CompilerEndIf
 ; EndIf
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
TomS
Enthusiast
Enthusiast
Posts: 342
Joined: Sun Mar 18, 2007 2:26 pm
Location: Munich, Germany

Re: TextEditGadgetEx resize scaling zoom

Post by TomS »

Yes it's fixed now.
But after clearing, none of the keys I hit are displayed in the editor (which can be expected, since the gadget doesn't have the focus) except for the last one.

So clear -> "le typing" -> click on editorarea -> "g" is being displayed after a short delay.
I don't think that's intended?

Commenting this part out didn't work on Win7 either. It's flickering as you said.
Maybe you should give the new CanvasGadget() a try.
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

Yes I'm going to try the new canvas gadget once I've got the code working with the current setup.
It may at least simplify the event and key input but won't make much difference to the editing.

No idea why g is being displayed, if you didn't press it?
You should be able to click in the gadget again and start typing!

It may help to see if it actually types the right keys before clearing it, it wouldn't surprise me if M$ changed their keyboard handling functions, I just took the path of least resistance implementing the input so is a bit dirty. (the canvas gadget sounds more attractive by the minute)
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

Redid the drawing again. right panel was taking ~35ms to render it's now down to ~10 but should really be ~5-7ms
Can't see any difference in the speed on XP but then it's running in a VM and it clearly doesn't like the alpha blending
Windows 11, Manjaro, Raspberry Pi OS
Image
User avatar
idle
Always Here
Always Here
Posts: 5890
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: TextEditGadgetEx resize scaling zoom

Post by idle »

v 0.54a

Added scroll down on user input so text stays at the bottom of the gadget
note only happens on input after a return.

Added page navigation
Page up
Page down
Home
End

Changed mouse wheel scroll to scroll by current text height
Windows 11, Manjaro, Raspberry Pi OS
Image
Post Reply