Jump to content

Mike Warren

Members
  • Content Count

    64
  • Joined

  • Last visited

Community Reputation

2 Neutral

Technical Information

  • Delphi-Version
    Delphi 11 Alexandria

Recent Profile Visitors

916 profile views
  1. Mike Warren

    Hide Main Form on Start

    Actually, that StackOverflow thread looks like it might contain the answer in the second reply. Overriding the CanShow method seems to stop the flash. function TForm1.CanShow: Boolean; begin Result := not Timer1.Enabled; end; procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; Left := 500; Top := 200; Visible := True; end;
  2. Mike Warren

    Hide Main Form on Start

    Thanks for the reply, Nigel. Unfortunately, the form flashes up briefly at the default position and size before being hidden. Below is something I just thought of. It seems to work fine on Windows. I'm not able to test on Mac at the moment. unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs; type TForm1 = class(TForm) Timer1: TTimer; procedure FormCreate(Sender: TObject); procedure Timer1Timer(Sender: TObject); private StartLeft: Integer; public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.FormCreate(Sender: TObject); begin StartLeft := Left; Left := MaxInt; Timer1.Interval := 4000; Timer1.Enabled := True; end; procedure TForm1.Timer1Timer(Sender: TObject); begin Timer1.Enabled := False; Left := StartLeft; end; end.
  3. Mike Warren

    Hide Main Form on Start

    In the past all I needed to do was add Application.ShowMainForm := False, but FMX does not have ShowMainForm. Setting the main form's Visible property to False, either at design time, or in Form.Create does nothing, and adding MyForm.Visible := False to the application anywhere before Application.Run causes an A/V. I need this to work on Windows and Mac, so a WinAPI solution is not suitable. Does anyone have a suggestion?
  4. Mike Warren

    Issue with TNumberBox

    I just tried a FMX NumberBox in D11.3 and D12 and find it a complete mess. Nothing about the operation is intuitive. In addition to your observation, if I try to highlight the text by clicking and dragging, any vertical mouse movement at all changes the value wildly. Ctrl+A does not work for me. Personally, I'd do my own thing and forget TNumberBox completely.
  5. That's what I used the first time where everything got messed up. I skipped it on the second installation and in the small amount of testing I've done the installation seems to have worked fine.
  6. Installing D12 was "fun" for me. I made the stupid mistake of trying to import settings from V11.3 and got dozens of errors during the install and each time I ran it. Tried uninstalling, and that took ages before finally locking up. Tried the uninstaller again, and got told it couldn't uninstall without telling me why. Fortunately, I run Delphi in a VM, so I just created a new duplicate of my working dev VM and installed it from there. Don't really understand why the "offline" installer spent most of its time downloading things, but finally it completed. One of the bugs that was causing me problems is fixed. Another has supposedly been fixed, but has not, and within the first 10 minutes I found a couple of new bugs. I'm looking forward to the first maintenance release.
  7. Mike Warren

    [FMX beginner] Key Handling

    This issue is mostly fixed in D12. Only tested on Windows so far. Accelerator keys work in TMainMenu and on TButton.Text without causing a Windows beep. Shortcuts using Alt+<letter> do not work in menus, but they do work in actions. Alt + the first letter of a root main menu item will open that menu and then the first letter of each sub-menu item will highlight it, but not select it. So even though this is not exactly the behaviour in VCL, at least it's workable.
  8. Mike Warren

    User Drawing of Lines and Curves

    It doesn't appear to be fixed to me.
  9. Mike Warren

    User Drawing of Lines and Curves

    Looks like this bug has been fixed in D12 according to the QC. I haven't installed D12 yet to check.
  10. Mike Warren

    LongClick listbox selected Item

    A simplistic approach might be to use MouseDown and trigger a timer. In MouseUp reset the timer if it hasn't expired. I haven't put a lot of thought into this, but feel it should be possible to make it work.
  11. Mike Warren

    Zooming At Mouse Position

    Okay, this seems to work: var P1, P2: TPointF; begin // Mouse location on page before zoom P1 := (sbView.ScreenToLocal(Screen.MousePos) + sbView.ViewportPosition) / CurrentPage.Zoom; if WheelDelta > 0 then begin Z := CurrentPage.Zoom + 0.1; if Z > 4 then Z := 4; end else begin Z := CurrentPage.Zoom - 0.1; if Z < 0.1 then Z := 0.1; end; // Mouse location on page after zoom P2 := (sbView.ScreenToLocal(Screen.MousePos) + sbView.ViewportPosition) / Z; sbView.ViewportPosition := sbView.ViewportPosition + ((P1 - P2) * Z); CurrentPage.Zoom := Z;
  12. Mike Warren

    Zooming At Mouse Position

    Good point. This is simplified because I couldn't get it to work in a way that makes sense to me. I have a member that gets set in the page's MouseMove event: FMouseOnPage: TPointF But I took that out for testing, expecting the zoom to at least stay centred. But It does that weird curve.
  13. Mike Warren

    Zooming At Mouse Position

    I don't know what I'm doing wrong, but I can't seem to get this to work properly. For each page (TFrame) I have a TScrollBox that contains a number of Layers (TScaledLayout), which in turn contain a bunch of components. I zoom in and out using the mouse wheel and want the position of the frame to remain visually locked to the mouse cursor as I zoom. What I thought would work would be to change the Scrollbox.ViewportPosition as I zoom, but this produces a non-linear movement (a strange curve). Each step of the mouse wheel changes the zoom in 10% increments. Here's the code: if WheelDelta > 0 then begin Z := CurrentPage.Zoom + 0.1; if Z > 4 then Z := 4 else CurrentPage.sbView.ViewportPosition := CurrentPage.sbView.ViewportPosition * 1.1; end else begin Z := CurrentPage.Zoom - 0.1; if Z < 0.1 then Z := 0.1 else CurrentPage.sbView.ViewportPosition := CurrentPage.sbView.ViewportPosition / 1.1; end; CurrentPage.Zoom := Z; This is the Zoom code: procedure TfrmPage.SetZoom(const Value: Single); var I: Integer; begin FZoom := Value; for I := 0 to LayerCount -1 do Layers[I].Zoom := FZoom; end; // The layer frame is not shown. Instead, the ScaledLayouts are parented to the page frame's scrollbox procedure TfrmLayer.SetZoom(const Value: Single); begin FZoom := Value; slContent.Width := slContent.OriginalWidth * FZoom; slContent.Height := slContent.OriginalHeight * FZoom; end; The video below shows what happens. What am I doing wrong?
  14. Mike Warren

    Issue with TMenuBar and Alt key

    Done.
  15. Mike Warren

    Issue with TMenuBar and Alt key

    Excellent! If you do report it, post the link here and I'll vote for it.
×