stacker_liew
-
Content Count
106 -
Joined
-
Last visited
-
Days Won
1
Posts posted by stacker_liew
-
-
Now I'm using this one also, but the result still the same, Delphi 11.1 no problem, Delphi 10.4.2 and Delphi 10.3.3 both can't compile android apk.
-
I have used 64bit of OpenJDK 17.0.28 in Delphi 11.1, it can compile 64bit apk and aab without any problem, but when I tried with Delphi 10.3.3 and Delphi 10.4.2, it ends up with "could not create the Java Virtual Machine".
I wonder whether is the version of jdk doesn't supported these two version of IDE? And what version of OpenJDK does these two IDE supported?
I'm using Windows 11
-
20 minutes ago, stacker_liew said:Setting the acnchors after creating the components doesn't work.
Done with setting the correct position and size on the form's OnResize event, thanks.
-
On 5/15/2022 at 7:45 PM, aehimself said:You either manually set the position on the form's OnResize event or set the proper anchors after creating the components.
Setting the acnchors after creating the components doesn't work.
-
18 minutes ago, stacker_liew said:Thanks, it works now.
BTW, how to handle when the form is resized while the processing is doing?
-
45 minutes ago, Remy Lebeau said:That is because the TProgressBarInStatusBar.CreateIn() code provided earlier is not taking the Left position of the specified TStatusPanel into account, only its Width and Height. So it is positioning the TProgressBar in the wrong place for any TStatusPanel other than the 1st one.
Unfortunately, neither TStatusBar nor TStatusPanel provide a property or method to get the Left position of a TStatusPanel, so you will have to retrieve it manually, either by:
- looping through the TStatusBar.Panels collection:
function GetLeftOfStatusPanel(APanel: TStatusPanel); Integer; var I: Integer; Coll: TStatusPanels; begin Result := 0; Coll := APanel.Collection as TStatusPanels; for I := 0 to APanel.Index-1 do Inc(Result, Coll[I].Width); end;
- or by asking the OS directly:
uses ..., Winapi.CommCtrl; function GetLeftOfStatusPanel(APanel: TStatusPanel); Integer; var R: TRect; begin SendMessage((APanel.Collection.Owner as TStatusBar).Handle, SB_GETRECT, APanel.Index, LPARAM(@R)); Result := R.Left; end;
In which case, since CreateIn() wants the TProgressBar to fill the full rectangle of the TStatusPanel anyway, I would just ask the OS for the rectangle and use it as-is, eg:
uses ..., Winapi.CommCtrl; class procedure TProgressBarInStatusBar.CreateIn(const inStatusBarPanel: TStatusPanel; var outProgressBar: TProgressBar; var outLabel: TLabel); var statusbar: TStatusBar; R: TRect; Begin statusbar := inStatusBarPanel.Collection.Owner As TStatusBar; SendMessage(statusbar.Handle, SB_GETRECT, inStatusBarPanel.Index, LPARAM(@R)); outProgressBar := TProgressBar.Create(statusbar); outProgressBar.Parent := statusbar; outProgressBar.Top := R.top; outProgressBar.Left := R.left; outProgressBar.Width := R.Width; outProgressBar.Height := R.Height; outLabel := TLabel.Create(outProgressBar); outLabel.Parent := outProgressBar; outLabel.Align := alClient; outLabel.AutoSize := False; outLabel.Alignment := taCenter; end;
Thanks, it works now.
-
On 5/13/2022 at 4:04 PM, aehimself said:Something like this:
Var pbar: TProgressBar; lbl: TLabel; a: Integer; Begin TProgressBarInStatusBar.CreateIn(StatusBar1, pbar, lbl); For a := 0 To 1000 Do Begin pbar.Position := a Div 10; lbl.Caption := 'Working ' + a.ToString + '...'; Application.ProcessMessages; // Don't do this. It's just pseudocode. Sleep(500); End; End;
Does this method support multiple TStatusPanel? I tried with a TStatusPanel in Panel[1], but the ProgressBar, still appear in Panel[0].
-
8 hours ago, aehimself said:Something like this:
Var pbar: TProgressBar; lbl: TLabel; a: Integer; Begin TProgressBarInStatusBar.CreateIn(StatusBar1, pbar, lbl); For a := 0 To 1000 Do Begin pbar.Position := a Div 10; lbl.Caption := 'Working ' + a.ToString + '...'; Application.ProcessMessages; // Don't do this. It's just pseudocode. Sleep(500); End; End;
Thanks
-
3 hours ago, aehimself said:I create my progress bars in the first panel of the status bar, with a label on it to show some meaningful information on the progress... like "30 of 999 items processed". Yes, it won't work if you resize the panel, needs some adjustments if you want to create it in the 3rd, but this is the code I use:
Unit uProgressBarInStatusBar; Interface Uses Vcl.ComCtrls, Vcl.StdCtrls; Type TProgressBarInStatusBar = Class public Class Procedure CreateIn(Const inStatusBarPanel: TStatusPanel; Var outProgressBar: TProgressBar; Var outLabel: TLabel); End; Implementation Uses Vcl.Controls, System.Classes; Class Procedure TProgressBarInStatusBar.CreateIn(Const inStatusBarPanel: TStatusPanel; Var outProgressBar: TProgressBar; Var outLabel: TLabel); Var statusbar: TStatusBar; Begin statusbar := inStatusBarPanel.Collection.Owner As TStatusBar; outProgressBar := TProgressBar.Create(statusbar); outProgressBar.Parent := statusbar; outProgressBar.Top := 2; outProgressBar.Left := 1; outProgressBar.Width := inStatusBarPanel.Width - 3; outProgressBar.Height := statusbar.ClientHeight - 3; outLabel := TLabel.Create(outProgressBar); outLabel.Parent := outProgressBar; outLabel.Align := alClient; outLabel.AutoSize := False; outLabel.Alignment := taCenter; End; End.
The small sacrifice of having it in the first panel makes up to it with no custom drawings / hacks needed at all. And it looks good enough:
Thanks, how to use it?
-
1 hour ago, Remy Lebeau said:Or, at the very least, calling Update() on the TProgressBar or TForm. Or, the example shown, by simply using a timer or thread instead of a blocking loop, let the main message queue run unblocked and handle UI updates normally.
That being said, TStatusBar is not really intended to host child controls. And using a *drawing* event to update UI layout is a big no-no in general.
Any time I've ever needed to show a progress bar inside of a status bar (or, any other non-container parent, such as TListView or TTreeView, etc), I always prefer to owner-draw the parent and actually draw a progress bar myself. I never try to hack in a TProgressBar as a child control. Especially in a parent that can be resized/scrolled at runtime. Keeping a TProgressBar positioned correctly at all times can get ugly quick.
Any example of these?
-
41 minutes ago, PeterBelow said:If you used the button OnClick handler from the link you gave it will not work unless uncomment the Application.ProcessMesssages call.
I tried with Application.ProcessMessage still no effect for ProgressBar.
-
-
-
I have a project built in Windows 7 using same source, run under Windows 7 perfectly, but when run under Windows 10, invalid date format happen, any one have this problem before?
-
On 12/11/2019 at 1:35 PM, Rollo62 said:Didn't you choose to install Java JDK during RadStudio WebInstaller ?
No I install RAD Studio via ISO.
-
Some one told me to just copy the bin to C:, and I have tried it, it works. Thanks
-
-
I created a qr code scan app using ZXing Delphi (https://github.com/Spelt/ZXing.Delphi) in 10.3.1, it's working fine, but after upgraded to 10.3.2, it's no longer scan qr code anymore, does any one face same problem with me?
-
On 4/28/2019 at 11:31 AM, Dave Nottage said:Make a copy of (bds)\source\fmx\FMX.Media.Android.pas, and put it in your project folder. Modify this routine:
function CreateJBitmapFromYuvBuffer: JBitmap; var Image: JYuvImage; Rect: JRect; Stream: JByteArrayOutputStream; LoadOptions: JBitmapFactory_Options; begin SurfaceSection.Acquire; try Image := TJYuvImage.JavaClass.init(SharedBuffer, SharedBufferFormat, PreviewBufferSize.X, PreviewBufferSize.Y, nil); finally SurfaceSection.Release; end;
Replacing the SurfaceSection references with QueueSection
Thanks.
-
17 hours ago, Dave Nottage said:There's a workaround in the report.
Can you show me the workaround, I can't access to the server for some reason.
Thanks
-
On 4/22/2019 at 7:19 AM, Dave Nottage said:If you mean on Android, this report relates to the issue:
https://quality.embarcadero.com/browse/RSP-23791Any solution?
-
Verify your path in Android/IOS platform, since it different from Windows.
-
Even though in Android 6,0, there also have issue with 10.3.1 (because of the August 2018, Google Issue, Android 26 API), better upgrade to Android 7 ~ 9.
-
As title, TCameraComponent always crash while in capturing mode for a certain time. Any one experienced this with 10.3.1?
OpenJDK Version Support In Delphi 10.3.3 And Delphi 10.4.2
in Cross-platform
Posted
But now I manage to build 32bit apk in Delphi 10.4.2 but 64 bit with result [DCC Error] E2597 C:\\Users\\Public\\Documents\\Embarcadero\\Studio\\21.0\\CatalogRepository\\AndroidNDK-21-21.0.40680.4203\\android-ndk-r21\\platforms\\android-23\\arch-arm\\usr\\lib\\crtbegin_so.o: error adding symbols: File in wrong format
Delphi 10.3.3, OK now