EditorGadGet
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
EditorGadGet
is there any way to move the cursor to a word in the EditorGadget?? 
Re: EditorGadGet
What word do you want to move the cursor to? Next word? First occurrence of a specific word, like "Abc"? 2nd word on 3rd line?
You can set and get the cursor, you can set a selection, you can get the text, and more. Depending on your needs,
it is just a matter of some string scanning and setting the cursor. It is also important what 'word' means to you,
for example [a-z]|[A-Z] or _|[a-z]|[A-Z], followed by _|[a-z]|[A-Z]|[0-9], Greek alphabet, or Thai letters only?
奥地利(欧洲中部国家) = 오스트리아 = ออสเตรีย = Австрия = Αυστρία = Østerrike = Itävalta = République d'Autriche = Österreich = Austria
You can set and get the cursor, you can set a selection, you can get the text, and more. Depending on your needs,
it is just a matter of some string scanning and setting the cursor. It is also important what 'word' means to you,
for example [a-z]|[A-Z] or _|[a-z]|[A-Z], followed by _|[a-z]|[A-Z]|[0-9], Greek alphabet, or Thai letters only?
奥地利(欧洲中部国家) = 오스트리아 = ออสเตรีย = Австрия = Αυστρία = Østerrike = Itävalta = République d'Autriche = Österreich = Austria
Re: EditorGadGet
Is this what you're looking for?
http://www.purebasic.fr/english/viewtop ... 43#p431543
http://www.purebasic.fr/english/viewtop ... 43#p431543
MacBook Pro-M1 (2021), Tahoe 26.2, PB 6.30b6
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
yes, that works 
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
I am trying to check if an Editor Gadget has an attachment. This is the code I am using
Define exists.b
CocoaMessage(@exists, gadget, "containsAttachments")
But I get an invalid memory error
I think something wrong in my code
Define exists.b
CocoaMessage(@exists, gadget, "containsAttachments")
But I get an invalid memory error
I think something wrong in my code
Re: EditorGadGet
Is 'gadget' the GadgetID()? What about defining 'exists' as .l or .i?
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
Danilo,
Yes, gadget is the ID of the EditorGadget.
Yes, gadget is the ID of the EditorGadget.
Re: EditorGadGet
You need textStorage. Once you have the textStorage object, you can do a lot with that.
Code: Select all
textStorage = CocoaMessage(0, GadgetID(0), "textStorage")
Debug CocoaMessage(0, textStorage, "containsAttachments")Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
Thanks Wilbert 
-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
Oh, another problem I am having is zooming text in and out of editorGadget, I am using this code.
I am trying to access ScrollView to zoomScale, but I get an error
ScrollView = CocoaMessage(0,GadgetID(0),"ScrollView")
CocoaMessage(0, ScrollView, "zoomScale:@",2)
I am trying to access ScrollView to zoomScale, but I get an error
ScrollView = CocoaMessage(0,GadgetID(0),"ScrollView")
CocoaMessage(0, ScrollView, "zoomScale:@",2)
Re: EditorGadGet
Try enclosingScrollView instead.
Edit: zoomScale also doesn't seem to exist. It might be more complicated.
It looks like you need scaleUnitSquareToSize: on the editor gadget itself.
Edit: zoomScale also doesn't seem to exist. It might be more complicated.
It looks like you need scaleUnitSquareToSize: on the editor gadget itself.
Windows (x64)
Raspberry Pi OS (Arm64)
Raspberry Pi OS (Arm64)
Re: EditorGadGet
Not that much complicated:
Code: Select all
size.NSSize
size\width = 5.0
size\height = 2.0
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
Thanks Guys
Danilo, it works scaling, but when you want to make it smaller it does not work.
size\width = 1.5
size\height = 1.5
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)
this will scale the text up, then if I do this
size\width = 1.0
size\height = 1.0
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)
It does not scale back?
Danilo, it works scaling, but when you want to make it smaller it does not work.
size\width = 1.5
size\height = 1.5
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)
this will scale the text up, then if I do this
size\width = 1.0
size\height = 1.0
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)
It does not scale back?
Re: EditorGadGet
Code: Select all
size.NSSize
size\width = 0.5
size\height = 0.5
CocoaMessage(0,GadgetID(0),"scaleUnitSquareToSize:@",@size)-
spacebuddy
- Enthusiast

- Posts: 364
- Joined: Thu Jul 02, 2009 5:42 am
Re: EditorGadGet
Thanks Danilo
Do I need to put
CocoaMessage(0,GadgetID(0),"setNeedsDisplay:",#YES)
to refresh the screen?
Do I need to put
CocoaMessage(0,GadgetID(0),"setNeedsDisplay:",#YES)
to refresh the screen?

