Mark Gorst
Members-
Content Count
6 -
Joined
-
Last visited
Everything posted by Mark Gorst
-
I'm trying to replicate some behavior I have in VCL Form. I have video updating in a TForm and when I resize that form I want to stop the video updating until the resize is complete. The Resize() is working fine, but I want to use FMX.Forms.TCommonCustomForm.StartWindowResize(). I have created an override function, but resizing the window does not seem to call my code. Everything else seems to work. If I make StartWindowResize() protected rather than public the compiler warns me about this having lower visibility - so that means that it is overriding the virtual stub. csDesigning is not in the component state, Does anyone have any suggestions, There seems to be almost no mention of using StartWindowResize() anywhere.... Mark type TForm1 = class(TForm) Label1: TLabel; Timer1: TTimer; procedure FormResize(Sender: TObject); procedure Timer1Timer(Sender: TObject); public procedure StartWindowResize;override; end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.StartWindowResize; begin timer1.Enabled:=false; ShowMessage('StartWindowResize'); inherited; end; procedure TForm1.Timer1Timer(Sender: TObject); begin label1.text:=FormatDateTime('hh:nn:ss.zzz',now); end;
-
I eventually found a way to deal with this. I stopped trying to capture the resize of the form and instead moved to the TPanel on which all the components are placed. The TPanel is client aligned to the TForm and so when the form is resized, the TPanel is always resized and I can capture the OnResize and OnResized events. If you drag the edge of the form then it will trigger a lot of pairs of these events. As I want to resize and restart my video which has a modest overhead, I use the OnResize to reset and start a TTimer so if resizing has has stopped for around 400ms then I resize and restart my video stream. Works on Windows, I'm not working with this on other platforms as the video is only supported on a single platform.
-
As a follow up to this "StartWindowResize" is only called when you MouseDown on a control that supports an ISizeGrip interface. It doesn't get called (on a Windows platform) when you drag the form edge, use the size icon, or change the width or height values. I have yet found out how to do the equivalent of the Windows WM_ENTERSIZEMOVE/WM_EXITSIZEMOVE messages.
-
Ok. I'll address this as best I can - and I'm only interested in FMX in the Windows environment. On the basis of what you tell me the StartWindowResize is of little use, because if you resize your window using the mouse to drag the border or use the minimise/maximise icon - then this will never be called, even worse on the same basis StartWindowDrag will never be called because it's not called in FMX.Forms at all. So as functions they are off little use. I understand that FMX and VCL are not the same framework and will do different things. I simply mention the VCL messaging as that's the functionality I was hoping to reproduce. Thank you for your tip about a flag to start/stop a task, however it's not quite that simple with the devices I'm using. I have got a different way of programming around the issue, It's just I thought that these two functions might do what the documentation implies, rather than StartWindowResize() only be called in a subset of resize circumstances and StartWindowDrag() never being used at all.
-
I can see this is one way it is called. However a MouseDown() event is not the only way to resize a TForm. For instance maximising a window causes a Resize event to occur, but it is not a mouse down event, nor is dragging the border, this does not cause a MouseDown event. I need to be able to avoid updating my TForm whilst it is being resized by the user. The call in MouseDown() is only triggered if you put the mouse down over an object [ ObjectAtPoint() <> nil] Similarly with StartWindowDrag whereby you can override to have your own code once you have started to drag the window, and that is not called at all in FMX.Forms directly, but I also have tried my own override on that and it does not get called when there is a drag event. What I am trying to get at is the equivalent of a WMEnterSizeMove message in VCL So either the system is not calling StartWindowResize() for some reason, or my override is incorrect, I'm not expecting to call this manually, if so what's the point in having the virtual stub for TComonCustomForm ?
-
Thanks. I have read the help, and you'll note that I said "csDesigning is not in the component state," in mypost. That is to say I did a break in TForm1.FormResize() when runing and the WatchList shows that "componentState = []" I'm assuming that is what the documentation is referring to ?