Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Widgets - General questions or Mixed problems » How to use caret / caretCtrl in a custom control [SOLVED]
How to use caret / caretCtrl in a custom control [SOLVED] [message #43351] Wed, 09 July 2014 20:40 Go to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
I'm buiding a custom control "from scratch" and want to have a caret in it.
I don't want to re-invent the wheel and would rather make use of the existing
code for using the caret in a control, so what do I need to do to make use of
the caret / caretCtrl that already exists?

(I tried to follow what the existing 'edit'-type controls do, but the code is
all over the place and the logic is hard to decipher.)

Edit - Solved:
It's as simple as just calling SetCaret(..) - with _valid_ values Smile
(I was looking for complexity where there wasn't any - I should have
learned by now that most things in upp is simple & easy Embarassed )

[Updated on: Thu, 10 July 2014 14:29]

Report message to a moderator

Re: How to use caret / caretCtrl in a custom control [message #43352 is a reply to message #43351] Wed, 09 July 2014 21:36 Go to previous messageGo to next message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hi Slashupp,

Why not having derivatized your custom control from UPP Ctrl object to keep features like caret and so on...? Smile

Cheers

Biobytes
Re: How to use caret / caretCtrl in a custom control [message #43353 is a reply to message #43352] Wed, 09 July 2014 21:51 Go to previous messageGo to next message
slashupp is currently offline  slashupp
Messages: 231
Registered: July 2009
Experienced Member
My custom controls descend from Ctrl:

struct MyControl : public Ctrl
{
Point MyCursor; //keeps track of insertion point, so can be used to position the caret
...
void Paint(Draw &drw)
{
..drw.Draw_all_kinds_of_stuff(..);
}
};

.. so the caret functions are available I just can't figure out how to apply/use them.
Re: How to use caret / caretCtrl in a custom control [message #43364 is a reply to message #43353] Fri, 11 July 2014 21:45 Go to previous message
BioBytes is currently offline  BioBytes
Messages: 307
Registered: October 2008
Location: France
Senior Member
Hello Slashupp,

Sorry for late reply due to be busy IRL.

Ctrl object has SetCaret function:
void SetCaret(int x, int y, int cx, int cy)
or 
void SetCaret(const Rect& r)


void KillCaret() destroys the caret Inside the control.

Hope this is helpful Razz

Regards

Biobytes
Previous Topic: Bugfix: DocEdit, not to put back to wantfocus after clicking into it
Next Topic: mixed RichEdit widget with MFC Dialog.
Goto Forum:
  


Current Time: Thu Apr 18 11:44:40 CEST 2024

Total time taken to generate the page: 0.01804 seconds