Category: Firemonkey

What is a good way to compare 2 interfaces (IControl)? Is this a bug in Delphi?

  

In the source code of Delphi, I see this in the FMX.Forms unit:
procedure TCommonCustomForm.SetHovered(const Value: IControl);
begin
if (Value <> FHovered) then
begin
….
end;
end;

I think doing Value <> FHovered is fundamentally wrong because Value <> FHovered can return true and at the same time both Value and FHovered can point to the same TControl object. Am I wrong? (note this is what I saw in debugging).
Now a subsidiary question: why can 2 IControl interfaces be different (from the view of pointers) but point to the same TControl?
Note: below a sample that show how 2 IControl can be different (from the pointer view) and still pointing to the same object:
procedure TForm.Button1Click(Sender: TObject);
var LFrame: Tframe;
Lcontrol: Tcontrol;
LIcontrol1: Icontrol;
LIcontrol2: Icontrol;
begin
Lframe := Tframe.Create(nil);
Lcontrol := Lframe;
LIcontrol1 := Lframe;
LIcontrol2 := Lcontrol;
if LIcontrol1 <> LIcontrol2 then
raise Exception.Create(‘Boom’);
end;

Now also what could be the good way to fix this bug ?

Read More

FMX Desktop – Restrict Form Size on Windows and macOS

  

I’m in the process of porting over an old VCL application to FMX. At this time I’m only concerned with creating a desktop application that will run on Windows and macOS. One of the VCL features I like is the ability to set the forms minimum width and height properties. This prevents the user from making the application ridiculously small and unusable.With a VCL application this is accomplished by simply entering the desired values in the MinHeight and MinWidth properties of the forms Constraints. The example below sets the VCL forms minimum height to 540 and the minimum width to 720.Unfortunately, these properties do not exist within FMX Muilti-Device applications. In order to impose size constraints in FMX you have to write some code in the OnResize event handler. The simplest way to accomplish this would be to right some code similar to this: const MinW = 720; MinH = 540;begin if Width < MinW then Width := MinW; If Height < MinH then Height := MinH;end; This works. However it produces a horrible flickering effect when you continue to drag the mouse inside the boundaries specified within the OnResize event handler.Windows Form Constraints with FlickeringWhat about the macOS? Does it flicker? The answer is no. The macOS respects the size constraints with no flickering issue:macOS Form Constraints no FlickeringSo the issue only happen on Windows PC’s. I may be oversensitive here but I do not like this flickering at all. In my mind it gives the sense of an unprofessional appearance. Some end users may not care one bit about this and that’s fine. However, it really bugs me. I want to prevent this from happening.So I went looking for a solution and found one on stackoverflow. The code simulates a mouseUp event if the cursor moves inside the boundaries.Windows Form Constraints with No FlickeringThis is accomplished by making a Windows API Mouse Event call inside the OnResize event handler. It’s not perfect but it does prevent the flickering from happening.Add this to the Uses clauseWinapi.WindowsModify the onResize event handler to simulate the mouseUp event. const MinW = 720; MinH = 540;begin if Width < MinW then begin Width := MinW; mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); end; If Height < MinH then begin Height := MinH; mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); end;end; This code works great! It stops Windows PC’s from flickering. However, we are not done yet. We have to wrap special tags around the Windows Only code so it is ignored by the macOS.Modify the Uses clause as follows: uses{$IFDEF MSWINDOWS} Winapi.Windows,{$ENDIF} System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Controls.Presentation, FMX.StdCtrls; Modify the onResize event handler as follows procedure TForm1.FormResize(Sender: TObject);const MinW = 720; MinH = 540;begin if Width < MinW then begin Width := MinW; {$IFDEF MSWINDOWS} //prevent form flickering on resize below constraints mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); {$ENDIF} end; If Height < MinH then begin Height := MinH; {$IFDEF MSWINDOWS} //prevent form flickering on resize below constraints mouse_event(MOUSEEVENTF_ABSOLUTE or MOUSEEVENTF_LEFTUP, 0, 0, 0, 0); {$ENDIF} end;end; Stay tuned for more FMX Desktop discoveries. Related Articles:What Every Delphi Developer Should Know About Writing for Windows and MacEnjoySemper FiGunny Mikehttps://zilchworks.com end.

Read More

TButton does not identify the procedure written by hand delphi fmx

  

I have a TButton on my Form, and I have a procedure that when clicking on this button executes a ShowMessage. Simple. The problem is that I ‘erased’ this procedure completely and then rewrote it perfectly as it was. The problem is then the button doesn’t work anymore, nothing happens. If by chance I click 2x, it will direct a procedure written manually by me and then it works. I would like to know why?
(NOTE: I pasted in the 360 ​​code ​​procedures for 360 buttons in another delphi fmx project and I would not like to click on 360 buttons just for it to identify a procedure)
Thanks.

Read More

Is Verb Technology Company Inc (VERB) a smart choice when it comes to software

  


Verb Technology Company Inc (VERB) is near the top of its industry group according to Investors Observer. VERB gets an overall rating of 57. This means that it scores over 57% of actions. Verb Technology Company Inc is ranked 93 in the Software – Applications sector. Software – The app is number 123 out of 148 industries.

VERB has an overall score of 57. Find out what that means to you and get the rest of the leaderboard on VERB!

What do these notes mean?
Finding the best stocks to invest in can be difficult. There are thousands of options out there and it can be confusing to know what really constitutes great value. Investors Observer lets you choose from eight unique metrics to show top sectors and top performing stocks in that sector. A score of 57 would rank higher than 57 percent of all stocks. Our proprietary rating system captures technical factors, fundamental analysis and the opinions of Wall Street analysts. That makes
Investors Observer
The overall credit score is a great way to start, regardless of your investing style. Percentile scores are also easy to understand. A score of 100 is the high and a 0 is the low. There is no need to try to remember what is “good” for a bunch of complicated ratios, just watch out for the higher numbers.
What is happening with the shares of Verb Technology Company Inc today?
Verb Technology Company Inc (VERB) stock is trading at $ 1.54 at 1:26 p.m. on Tuesday, December 14, a loss of – $ 0.08, or -4.66% from the previous closing price of $ 1.61. The stock has traded between $ 1.52 and $ 1.61 so far today. The volume is now below average. So far, 355,298 shares have been traded for an average volume of 1,476,426 shares. Click here for the full report on Verb Technology Company Inc.
Source link

Read More

Delphi 11 app in Android Play Store shows warning: Non-SDK API

  

The "Pre-launch report overview" in "Google Play Console" shows this warning:
Type:
Non-SDK API

API:
Landroid/view/MotionEvent;-><init>()V

Stack trace:
StrictMode policy violation: android.os.strictmode.NonSdkApiUsedViolation: Landroid/view/MotionEvent;-><init>()V

This error has previously been fixed in Delphi 10.3, see https://quality.embarcadero.com/browse/RSP-22046
but its now back in Delphi 11?
The solutions I can find on Google is about setting a newer targetSdkVersion in the AndroidManifest.xml
However, we already set it to API level 30, as it is required to deploy to the new Play Store. In AndroidManifest.xml we have:
<uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" />

Anyone having seen this error lately with a "Delphi 11" app on Play Store? – and eventually having found a solution?

Read More

Delphi 10.4.2 FMX: How to write the case where the user press return button on android phone instead of choice in message dialog box?

  

MessageDlg(‘Please turn on your gps’, TMsgDlgType.mtConfirmation,
[
TMsgDlgBtn.mbYes,
TMsgDlgBtn.mbNo,
TMsgDlgBtn.mbClose
], 0,
procedure(const AResult: TModalResult)
begin
case AResult of
mrYES: begin
LIntent := TJIntent.JavaClass.init(TJSettings.JavaClass.ACTION_LOCATION_SOURCE_SETTINGS);
TAndroidHelper.Context.startActivity(LIntent);
end;
mrNo:
Close;
mrClose:
Close;
mrNone:
Close;
end;
end);

Here are some code snippet I have been trying, I don’t want to let the user proceed and close the app when the user click return button on the phone.

Read More

Implementing ImageIndex property editor in my FMX component

I am designing a FireMonkey Component with TImageList and TImageIndex published properties. I can easily select a TImageList from the dropdown of the ImageList property, and the ImageIndex property seems to know that it should pick an image (it shows an icon next to the number), but there’s no images in the dropdown for this property (only for -1), and the icon for the (manually entered) ImageIndex value (0) is shown as a “no icon” image (the same as for -1 in the dropdown):

From the source (FMXReg.pas) it seems like I should call a line like this in my Register procedure:

RegisterPropertyEditor(TypeInfo(TImageIndex), MyControl, '', TImageIndexProperty);

but I can’t find TImageIndexProperty anywhere.

The component works – it selects the proper image from the ImageList as defined by the ImageIndex property, even if I can’t use the drop-down box (ie. if I enter the ID number manually).

How do I implement a proper ImageIndex property editor for my FireMonkey control? How do I tell it to look up the Images in the ImageList property?

(and yes: there are images in the ImageList, which I have verified by attaching the same ImageList to a standard TButton, and here the ImageIndex dropdown works without problems).

Read More

Read More

How do I access a file launching an Firemonkey iOS app?

  

I’m using Rad Studio 10.4.1.
Using a web browser, I downloaded a file of type psvz, owned by my app. The iOS Files app shows the file in the browser’s download folder and recognizes it as associated with my app. Tapping the filename launches my app. The event handler in my app receives the filename with a path that appears to be in the browser’s download folder: /private/var/mobile/Containers/Data/Application/8CD7612A-2F49-4E20-AD36-4AE092838B0E/Documents/Downloads/HighlandSprings.psvz.
Attempting to copy the file to a folder in my app with TFile::Copy results in a non-existent file error. TFile::Exists says the file doesn’t exist.
I’m guessing it’s something to do with iOS file permissions or the /private/ in the filename. How can I process a file passed to a Firemonkey iOS app during launch or how I can un-privatize or otherwise access the file that launched my app?

Read More

Agnito Technologies announces the recruitment of dedicated developers: create your software development team with Agnito

BHOPAL, INDIA, December 12, 2021 / 24-7PressRelease / – If you are preparing to launch your brand new ambitious project, the first step you need to do is find the right software development team. Without a doubt, the project you are going to tackle would be difficult, so having a suitable internal battery is a […] … Read More

Read More

Delphi MacOS request permission to use microphone

  

Delphi 11 project on MacOS is asking permission using this code:
procedure TCOWMainForm.Button1Click(Sender: TObject);
var
fMic: FMX.Media.TAudioCaptureDevice;
begin
fMic := TAVCaptureDeviceManager.Current.DefaultAudioCaptureDevice;
if (fMic <> nil) then
begin
ShowMessage(‘fMic not nil so calling fMic.RequestPermission’);
fMic.RequestPermission;
end;
end;

Project | Options | Version Info includes a key pair of
NSMicrophoneUsageDescription "COW records your voice."
Still, the project is killed when it calls fMic.RequestPermission, as per Apple documentation:
Requesting Authorization for Media Capture on macOS
What might I be missing in attempting to get permission to use the microphone in a macOS notarized app?
Edited to include this Embarcadero RSP which has a minimal project that reproduces the issue.
https://quality.embarcadero.com/browse/RSP-36541

Read More

Where Do National Instruments Corp (NATI) Stocks Fall in Software

  


Note 47 Investors Observer gives the shares of National Instruments Corp (NATI) places it near the top of the Software – Application industry. In addition to scoring over 80 percent of stocks in the software – applications industry, NATI’s overall rating of 47 means the stock scores over 47 percent of all stocks.

NATI has an overall score of 47. Find out what that means to you and get the rest of the leaderboard on NATI!

What do these notes mean?
Trying to find the best stocks can be difficult. There are a wide variety of ways to analyze stocks to determine which ones are performing the best. Investors Observer makes the whole process easier by using percentile rankings that make it easy for you to find stocks that have the strongest analyst valuations. Our proprietary rating system captures technical factors, fundamental analysis and the opinions of Wall Street analysts. That makes
Investors Observer
The overall credit score is a great way to start, regardless of your investing style. Percentile scores are also easy to understand. A score of 100 is the high and a 0 is the low. There is no need to try to remember what is “good” for a bunch of complicated ratios, just watch out for the higher numbers.
What is happening with the shares of National Instruments Corp today?
National Instruments Corp (NATI) stock is trading at $ 43.17 on Wednesday, December 8 at 10:26 a.m., a gain of $ 1.27, or 3.03% from the previous closing price of 41.90 $. The stock has traded between $ 41.89 and $ 44.00 so far today. The volume today is low. So far 146,717 shares have been traded for an average volume of 913,201 shares. Click here for the full National Instruments Corp. Stock Report.
Source link

Read More

Coloring individual Header backgroud in ListView

  

Is it possible in Delphi FMX to color individual Header background in ListView?
I know how to display text on listview header in OnUpdateObject, but is is possible to color background or draw rectangle for each header in own color?
procedure TForm6.ListView1UpdateObjects(
const Sender: TObject;
const AItem: TListViewItem);
var
pListItemText: TListItemText;
begin
if AItem.Purpose = TListItemPurpose.Header then
begin
pListItemText := AItem.Objects.FindObjectT<TListItemText>(‘Text’);

if pListItemText = nil then
pListItemText := TListItemText.Create(AItem);

if assigned(pListItemText) then
pListItemText.Text:=’TEXT’;
end;
end;

Read More

FMX: How to deal with strings containing right to left languages?

  

I have a unicode string that could contain characters from a right to left language such as Arabic or Hebrew, but could also contain text from left to right languages. I need to be able to know at which end is the start and in which direction to step when stepping through the string from beginning to end depending on which language is in the string. Is there a standard way of dealing with this?
TMemo appears to handle this in the way I want. I paste some hebrew text into a TMemo and the direction that the caret moves is the reverse of the arrow keys I use. I can even have a mixture of english and hebrew text in the same memo and the direction the caret moves will depend on whether it’s within an english or hebrew section of text. I’d like to replicate this behaviour. I attempted to look into the Delphi code including FMX.Memo and FMX.Text, but couldn’t find the code responsible. I have a feeling that the code for handling this may be hidden in a dll. I could write code myself that contains a list of all possible right to left unicode characters to test if a character is RTL or LTR, but I’d like to make use of code that already exists if possible. Can anyone point me in the right direction?
I do know about the unicode RLM mark, which is an invisible character used to mark a section of RTL text, but I don’t think this is being used by TMemo. The hebrew text I’m pasting into the TMemo doesn’t contain this or any other invisible character.

Read More