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 » Community » Newbie corner » [solved] Register a callback on "when window resized" ? (Would like to change ScatterCtrl grid major unit when resized)
Re: Register a callback on "when window resized" ? [message #52792 is a reply to message #52787] Mon, 25 November 2019 22:14 Go to previous messageGo to previous message
xrysf03 is currently offline  xrysf03
Messages: 43
Registered: November 2018
Location: CZ
Member
Oh, excellent, it appears to work Smile
Well kind of.
It works if I just resize the window in "normal size" mode.
For some reason, it doesn't work when I maximize the window. Actually it does seem to re-calculate the density of the MajorUnit grid for the maximized size, but the denser grid only gets applied after I "un-maximize" the window again - at which point the grid is already too dense Smile So it kind of "lags one step behind". Even if I finish it off by Ctrl::ProcessEvents() .

I have noticed that the TopWindow indeed has the Layout() method, and of course my main window inherits from that class (or some template around it), so I just added the overridden method to my existing class. (I did not need to inherit from ScatterCtrl and swap my own class into the visual layout.) A snippet of my example code follows:


class my_main_window : public Withmy_main_windowLayout<TopWindow> {

	[...misc stuff...]

	//Event<> WhenLayout; // not even necessary
	void Layout() override
	{
		// first and foremost, do whatever you need to 
		// with all the widgets (resize etc)
		Withmy_main_windowLayout<TopWindow>::Layout();

		// and then finally, mess with the ScatterCtrl
		set_chart_grid();

		Chart1.Refresh();  // doesn't make a difference
		Ctrl::ProcessEvents(); // doesn't make a difference
		//PromptOK("hello there");  // DOES make a difference?
	}
}


The "misbehavior" upon maximize is fairly consistent. I've tried adding a Chart1.Refresh() and/or Ctrl::ProcessEvents(), tried swapping the order of set_chart_grid() and the call to the upstream version of the Layout() method, I've also tried without calling the upstream version, to no avail. The only moment when the ScatterCtrl did reflect the desired changes "upon main window maximize", was when I also inserted some PromptOK("hello there") at the end of my overridden version of Layout().

It's curious, but I don't mind if that's just the way it is - as soon as I run my method that fetches some data from the back-end and displays them (which gets started by clicking a GUI button), the grid with appropriate spacing gets displayed in the ScatterCtrl Chart1.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: [SOLVED] ERROR: Not in table (destructor clobbered?)
Next Topic: WhenAction() -> ProcessEvents() -> WhenAction() -> hang, crash :-)
Goto Forum:
  


Current Time: Thu May 02 18:57:41 CEST 2024

Total time taken to generate the page: 0.04600 seconds