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++ Library : Other (not classified elsewhere) » design flaw in scatterctrl?
design flaw in scatterctrl? [message #49824] Sat, 12 May 2018 12:56 Go to next message
aftershock is currently offline  aftershock
Messages: 137
Registered: May 2008
Experienced Member
In Scatterctrl,

private:
bool showInfo;
Point clickPoint;
PopUpInfo popText;
String popTextX, popTextY, popTextY2;
Point popLT, popRB;
bool isZoomWindow;
const Point offset;
int copyRatio;
bool isLeftDown;

int butDownX, butDownY;
bool isScrolling, isLabelPopUp;

bool showContextMenu;
bool showPropDlg;
bool showProcessDlg;
bool showButtons;

int lastRefresh_ms;
dword lastRefresh0_ms;
int maxRefresh_ms;

bool highlighting;

Upp::Array<MouseBehavior> mouseBehavior;
Upp::Array<KeyBehavior> keyBehavior;

void ProcessPopUp(const Point & pt);

virtual void Paint(Draw& w);
virtual void LeftDown(Point, dword);
virtual void LeftDouble(Point p, dword);
virtual void LeftUp(Point, dword);
virtual void MiddleDown(Point, dword);
virtual void MouseMove(Point, dword);
virtual void MiddleUp(Point, dword);
public: // my fix
virtual void RightDown(Point, dword);
private:
virtual void RightUp(Point, dword);
virtual void MouseLeave();
virtual void MouseWheel(Point, int zdelta, dword);
virtual bool Key(dword key, int count);
virtual void GotFocus();
virtual void LostFocus();

void DoMouseAction(bool down, Point pt,

you can see a lot of the function are private when they are virtual.
I needed to use some of them.., not without modification..
Is this ok?

Re: design flaw in scatterctrl? [message #49825 is a reply to message #49824] Sat, 12 May 2018 21:18 Go to previous messageGo to next message
Klugier is currently offline  Klugier
Messages: 644
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello aftershock,

When package maintainer decided to follow your change he needs to make all virtual methods public. I do not see reason to change only one specific method that you need.

So the fix should look like this:
public: /* Ctrl */
void Paint(Draw& w) override;
void LeftDown(Point, dword) override;
void LeftDouble(Point p, dword) override;
void LeftUp(Point, dword) override;
void MiddleDown(Point, dword) override;
void MouseMove(Point, dword) override;
void MiddleUp(Point, dword) override;
void RightDown(Point, dword) override;
void RightUp(Point, dword) override;
void MouseLeave() override;
void MouseWheel(Point, int zdelta, dword) override;
bool Key(dword key, int count) override;
void GotFocus() override;
void LostFocus() override;

private:


Koldo, you can start using override statement instead of adding virtual. It guarantees on the compilation level that method is overridden.

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sat, 12 May 2018 21:25]

Report message to a moderator

Re: design flaw in scatterctrl? [message #49829 is a reply to message #49825] Sun, 13 May 2018 22:29 Go to previous messageGo to next message
koldo is currently online  koldo
Messages: 3044
Registered: August 2008
Ultimate Member
Thank you Aftershock

At least all of them should be public.


Hi Klugier

Thank you for your proposal. Could you indicate how to do it? I understood that "override" keyword was used in derived class, not in base class.


Best regards
Iñaki
Re: design flaw in scatterctrl? [message #49830 is a reply to message #49829] Sun, 13 May 2018 22:36 Go to previous message
Klugier is currently offline  Klugier
Messages: 644
Registered: September 2012
Location: Poland, Kraków
Contributor
Hello Koldo,

Just read about override keyword in http://en.cppreference.com/w/cpp/language/override. Here is my commit https://github.com/ultimatepp/mirror/commit/c19d097bc3c00538 74106568c740ad927c843de6 that do the same in TheIDE.

Quote:

Thank you for your proposal. Could you indicate how to do it? I understood that "override" keyword was used in derived class, not in base class.

Yes it only applies to derived class.

Sincerely,
Klugier


Ultimate++ - one framework to rule them all.

[Updated on: Sun, 13 May 2018 23:04]

Report message to a moderator

Previous Topic: click on a checkbox does not work , it does something else
Next Topic: I request the implementation of callback5
Goto Forum:
  


Current Time: Thu Dec 12 12:39:26 CET 2019

Total time taken to generate the page: 0.01900 seconds