Jump to content

Leaderboard


Popular Content

Showing content with the highest reputation on 12/01/18 in all areas

  1. Did you know that you can edit binary files inside the IDE? Just open a binary file in the IDE and you get a simple HEX editor.
  2. Georgge Bakh

    My first Delphi 10.3 impressions

    Not advocating dependency cycles but sometimes these are justified. For example when a big subsystem is separated to several units. These units will probably need each other as it's still a single subsystem and there is no higher level grouping for units with appropriate visibility rules. And of course it's not a reason for any of IDE features not to work.
  3. Uwe Raabe

    ImageName vs. ImageIndex

    Who hasn't seen this before: A bunch of controls and actions are linked to an ImageList with an ImageIndex, but as soon as you sort this ImageList to give it a sensible order all controls immediately start to show the wrong images. Wouldn't it be cool if instead a cryptic number as ImageIndex you could specify a descriptive name at the control? Thus the order of images inside the ImageList wouldn't matter at all. Of course, the ImageList has to support names in the first place. TPngImageList from PngComponents does that right from the beginning. So what about implementing that feature based on TPngImageList? Can't be that hard, can it? Well, it turned out to be a bit more complex than I anticipated, but that's probably because I had set my goals pretty high. So I expected to have a selection from image names for the ImageIndex properties of the control and thus a display of the image name instead of just a number. Also this scheme should be extendable to other controls and especially to other ImageLists supporting names. From this the ImageIndexMapper was born. A non-visual component to be placed on a form or datamodule, that when activated takes care of the image names. You just have to call one method to resolve those names to the actual corresponding number values. The attached ZIP file contains all the sources and files for the component and design time support as well as a sample project (currently for Delphi 10.2 Tokyo only). As a prerequisite you have to use PngComponents from the above source. I suggest to use the recent version V1.5.0 with direct ImageIndexMapper support. Older versions require the contained PNG Support Package to be installed and add the corresponding unit to your uses clause somewhere in your project. Version 1.5.0 makes this obsolete, Presumably there is much room for improvement. Whoever finds some time to test this component - please forward any encountered bug to me. Here is a short GIF showing the switch from TPngImageList to TImageList (without name support) in the Object Inspector: https://www.screencast.com/t/4MbJkygjFR ImageIndexMapper.zip Cross Post: https://www.delphipraxis.net/198212-imagename-statt-imageindex.html#post1415709
  4. GPRSNerd

    CCR.EXIF: Rio throws E2574

    I've solved it so far by using the orginal type declaration for compilers >= Rio. It might not be the most elegant solution, but it keeps up the spirit of the original code (I hope). {$IF CompilerVersion >= 33} {$DEFINE GenericTStringDynArray} {$IFEND} TIPTCStringArray = {$IFDEF GenericTStringDynArray} Array of String {$ELSE} type Types.TStringDynArray {$ENDIF}; //using 'type' means the helper defined below will only apply to it <OT> How to get rid of the empty quote object? </OT>
  5. Quick Example : private {$IFDEF ANDROID} fReadStorage:=JStringToString(TJManifest_permission.JavaClass.READ_EXTERNAL_STORAGE); fWriteStorage:=JStringToString(TJManifest_permission.JavaClass.WRITE_EXTERNAL_STORAGE); fBlueTooth:=JStringToString(TJManifest_permission.JavaClass.BLUETOOTH); {$ENDIF} procedure Tfrm????.FormShow(Sender: TObject); begin {$IF DEFINED(IOS) or DEFINED(ANDROID)} PermissionsService.RequestPermissions([fReadStorage,fWriteStorage,fBlueTooth], RequestPermissionsResult, DisplayRationale); {$ENDIF} end; procedure Tfrm????.RequestPermissionsResult(Sender: TObject; const APermissions: TArray<string>; const AGrantResults: TArray<TPermissionStatus>); begin if (Length(AGrantResults) = 3) and (AGrantResults[0] = TPermissionStatus.Granted) and (AGrantResults[1] = TPermissionStatus.Granted) and (AGrantResults[2] = TPermissionStatus.Granted) then // execute procedure ... as before on form show ... else Begin TDialogService.ShowMessage('No ....'); Application.Terminate; End; // če ne bi dovolili permission bi moral showerror end; {$ENDIF} {$IF DEFINED(IOS) or DEFINED(ANDROID)} procedure Tfrm????..DisplayRationale(Sender: TObject; const APermissions: TArray<string>; const APostRationaleProc: TProc); var I: Integer; RationaleMsg: string; begin for I := 0 to High(APermissions) do begin if APermissions = fReadStorage then RationaleMsg := RationaleMsg + 'Aplikacija zahteva branje pomnilnika' + SLineBreak + SLineBreak else if APermissions = fWriteStorage then RationaleMsg := RationaleMsg + 'Aplikacija zahteva pisanje pomnilnika'+ SLineBreak + SLineBreak else if APermissions = fBlueTooth then RationaleMsg := RationaleMsg + 'Aplikacija zahteva BlueTooth'; end; TDialogService.ShowMessage(RationaleMsg, procedure(const AResult: TModalResult) begin APostRationaleProc; end) end; {$ENDIF}
  6. Dave Nottage

    Android 8.0 Permissions errors using Delphi Rio 10.3

    You need to explicitly request those permissions at runtime. Check out the CameraComponent demo in: \Users\Public\Documents\Embarcadero\Studio\20.0\Samples\Object Pascal\Mobile Snippets\CameraComponent Also, there's no such permission as CAMERA_EXTERNAL_STORAGE. I expect you mean READ_EXTERNAL_STORAGE
×