Jump to content

Gustav Schubert

  • Content Count

  • Joined

  • Last visited

  • Days Won


Gustav Schubert last won the day on December 11 2019

Gustav Schubert had the most liked content!

Community Reputation

12 Good

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Gustav Schubert


    I have a Memo on my Form the content of which is updated often, programatically. It contains no more than a few lines, ScrollBars should never appear, by design, so I set property ShowScrollBars to False, when reviewing the code. But I needed to reverse the setting (should be true), because - if not - the user can scroll the content out of view, off the top edge of the control! ( My app in a nutshell will allow the user to select the current parameter, and then change the value of that parameter with the mouse wheel, when shift or ctrl is down. A normal mouse wheel delta will continue to be available for normal scrolling, of content in a Memo or Listbox, as expected. ) ( I also searched in quality portal, and found that the most relevant entry already had a test case project attached, uploaded by - guess who. RSP-12137 - FMX Memo Scrolling Bug. ) I attach the new test app here (zipped form), for "future reference". MemoWheelTest.zip
  2. I am using latest CE. If I open a file without BOM in Delphi, which was saved from VS Code, it is interpreted wrongly as ANSI. Changes to project options would go into the the .dproj file which I do not want to rely on. And further, I do not want to rely on the configuration of the IDE, when I come to another machine and check out a project. It is good thing if code reading ini files can cope with a BOM. Whether you want your files to have a BOM may be determined by factors that have nothing to do with ini files.
  3. Such as the Delphi IDE when loading pascal files. Visual Studio Code, which I use to do git, will assume UTF8. Using a file between the two environments only works if BOM is present. And my Merge tool (Araxis) also needs to be configured to copy with BOM. So for me it is three programs which need to be fine tuned as a set. ( When I work with a jekyll project, then BOM is forbidden, and I have to switch the configuration of the Merge tool. )
  4. Gustav Schubert

    IDE Screenshot too large?

    OK, I did not try to google it, admitted, but there is at least one more thing I did not do: suggest that there might be a bug, or search for RSP.
  5. Gustav Schubert

    IDE Screenshot too large?

    I have the Delphi IDE (10.3.3) maximized on HD-Monitor and create a screenshot with Alt-Print. Screenshot dimensions: exp: 1920 x 1040 act: 1928 x 1048 How come? Long version: I have a two Monitor setup, 2 x 1920 * 1080. My Windows Taskbar is at the bottom of the screen, height 40, standard. When I make a screenshot with Print key, it is too large, two screens horizontally. So I tried Alt-Print instead, after maximizing the App (IDE). Pasted Screenshot into MS-Paint and noticed extra space, bottom and right edge. Other apps, including my own VCL app, 'screenshot' as expected.
  6. I want to determine at runtime whether the app was compiled in Normal configuration or Application-Store configuration. Depending on this piece of info I plan to set my internal boolean IsSandboxed property. True - show standard dialogs to choose file name. False - read and save directly from/to a known filename according to convention. {$if defined(IOS) or defined(Android)} // Mobile Apps are sandboxed, but my internal IsSandboxed flag needs to be false, ok. IsSandboxed := false; // do not show file name dialogs {$endif} {$ifdef MACOS} // OSX Apps are sandboxed, have permissions set IsSandboxed := true; // use dialogs {$endif} {$ifdef MSWINDOWS} // I myself (dev) don't want to be bothered with the dialogs. IsSandboxed := false; // Normal configuration {$endif} // pseudo code follows, does not work {$if defined(MSWINDOWS) and defined(Configuration == App_Store)} IsSandboxed := true; // for Windows Store, play it safe, earn full_trust. {$endif} ( So far I have been reluctant to rename my IsSandboxed property. ) But what is the best way to know if my App runs in Application-Store config vs. Normal config? This question applies to VCL apps as well as FMX apps.
  7. Gustav Schubert

    No KeyUp for numpad keys after relese Shift

    Using ScanCode perhaps, in VCL? unit Unit1; interface uses Winapi.Windows, Winapi.Messages, Vcl.Forms; type TForm1 = class(TForm) procedure FormCreate(Sender: TObject); private ScanCode: Word; public procedure WMKeyDown(var Msg: TMessage); message WM_KEYDOWN; procedure WMKeyUp(var Msg: TMessage); message WM_KEYUp; end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); begin ScanCode := Lo(MapVirtualKey(VK_INSERT, 0)); end; procedure TForm1.WMKeyDown(var Msg: TMessage); var w: Word; b: Byte; begin w := Msg.LParamHi; b := LoByte(w); if b = ScanCode then Caption := 'down'; inherited; end; procedure TForm1.WMKeyUp(var Msg: TMessage); var w: Word; b: Byte; begin w := Msg.LParamHi; b := LoByte(w); if b = ScanCode then Caption := 'up'; inherited; end; end.
  8. Gustav Schubert

    No KeyUp for numpad keys after relese Shift

    VK_INSERT tests a virtual key not a real key, this is how I understand it after testing. Windows is reporting the insert STATE - on or off - when you call GetKeyState, possible return values: 0, -1, -127, or -128. You cannot even tell which of the insert keys or key combinations were used to toggle the state. In VCL, FormKeyPress triggers for KeyDown only, and FormKeyUp does not respond to the numpad numbers at all? ( In FMX, you can use FormKeyUp to successfully detect the '0' up character and know that the key was lifted. )
  9. Gustav Schubert

    XE5 > RIO

    I don't know if it works, I am just learning - how to code against the api, I only compile and read some interesting code. It is for the original poster to test it out, waiting ...
  10. Gustav Schubert

    No KeyUp for numpad keys after relese Shift

    So, it is best to use KeyDown and KeyUp in FMX to determine if any of the two insert keys is currently down? implementation {$R *.fmx} uses Windows; var IsInsertPressed: Boolean; procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); begin case key of 45: begin IsInsertPressed := True; UpdateCaption; end; end; end; procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; var KeyChar: Char; Shift: TShiftState); begin case key of 45: begin IsInsertPressed := False; UpdateCaption; end; end; case KeyChar of '0': begin IsInsertPressed := False; end; end; UpdateCaption; end; procedure TForm1.UpdateCaption; begin if IsInsertPressed then Caption := 'INSERT' else Caption := '0'; end; end.
  11. Gustav Schubert

    XE5 > RIO

    Yes, this compiles - with small changes - and looks much better. AVCaptureStillImageOutput = interface(iOSapi.AVFoundation.AVCaptureStillImageOutput) ['{A1669519-9901-489E-BDD1-A0E697C8C6CB}'] procedure addObserver(observer: Pointer; forKeyPath: NSString; options: NSKeyValueObservingOptions; context: Pointer); cdecl; procedure captureStillImageAsynchronouslyFromConnection(connection: AVCaptureConnection; completionHandler: TAVCaptureCompletionHandler); cdecl; end; TAVCaptureStillImageOutput = class(TOCGenericImport<AVCaptureStillImageOutputClass, AVCaptureStillImageOutput>) end; // objc_msgSendP4((FStillImageOutput as ILocalObject).GetObjectID, // sel_getUid('addObserver:forKeyPath:options:context:'), // FVideoCaptureDelegate.GetObjectID, // (StrToNSStr('capturingStillImage') as ILocalObject).GetObjectID, // NSKeyValueObservingOptionNew, // (FAVCaptureStillImageIsCapturingStillImageContext as ILocalObject).GetObjectID); TAVCaptureStillImageOutput.Wrap(FStillImageOutput).addObserver( FVideoCaptureDelegate.GetObjectID, StrToNSStr('capturingStillImage'), NSKeyValueObservingOptionNew, NSObjectToID(FAVCaptureStillImageIsCapturingStillImageContext)); { [stillImageOutput addObserver:self forKeyPath:@"capturingStillImage" options:NSKeyValueObservingOptionNew context:AVCaptureStillImageIsCapturingStillImageContext]; } Source Link.
  12. Gustav Schubert

    XE5 > RIO

    const libImageIO = '/System/Library/Frameworks/ImageIO.framework/ImageIO'; function objc_msgSendP4( theReceiver: Pointer; theSelector: Pointer; P1: Pointer; P2: Pointer; P3: LongWord; // ? P4: Pointer): Pointer; cdecl; overload; external libobjc name _PU + 'objc_msgSend'; You could find out if it is a long word or an Integer and if it works ...
  13. Gustav Schubert

    XE5 > RIO

    I am looking at Macapi.ObjCRuntime. There is a function objc_msgSendP2. What if you declare objc_msgSendP4? There are 5 calls to objc-msgSend in the uFMain unit. Three take two params, these do compile? One takes 4 Params, should be objc_msgSendP2? One takes 6 params, which should be objc_msgSendP4?
  14. Gustav Schubert

    How to get the selected Font from Picker on Mac

    I include a minimal test project for FMX, OSX64 target only, see attachment. ( You can change TRectangle.Fill.Color and TText.Font.Family via native dialogs, see screenshot. ) This seems to work somehow, but there are at least two remaining problems: 1) Color: If you change from Apple to Developer in combo box and continue to use the dialog - it will crash the App. 2) Font: selectedFont is the value navigated from, not the value navigated to; in the example the font family of the TText should be Arial Narrow, not Arial Black. I would like to understand the reason for problem 1, any idea? ChangeColorTest.zip
  15. Gustav Schubert

    How to get the selected Font from Picker on Mac

    OK, done, found and example of how to implement callback for Color, extended the case for Font, this seems to work.