Jump to content

Magno

Members
  • Content Count

    62
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Magno

  1. Magno

    Trying to share a text file

    Ok, I finally did something, at least. Now I can share files with WhatsApp, but it will fail to Telegram or other apps that could receive a file: procedure TForm1.ShareFile(const FileName: String); Var {$IFDEF ANDROID} Intent: JIntent; FileUri: Jnet_Uri; ListArqs: JArrayList; {$ENDIF} begin {$IFDEF ANDROID} ListArqs := TJArrayList.Create; FileUri := TJNet_Uri.JavaClass.fromFile(TJFile.JavaClass.init(StringToJString(FileName))); ListArqs.Add(0, FileUri); // if intend to send more file change the index (default 0) try Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_SEND); Intent.setType(StringToJString('image/text/plain')); Intent.putParcelableArrayListExtra(TJIntent.JavaClass.EXTRA_STREAM, ListArqs); Intent.setPackage(StringToJString('com.whatsapp')); // Intent.setPackage(StringToJString('org.telegram.messenger')); Intent.addFlags(TJIntent.JavaClass.FLAG_GRANT_READ_URI_PERMISSION); SharedActivity.startActivity(TJIntent.JavaClass.createChooser(Intent, StrToJCharSequence(''))); except on E: Exception do ShowMessage(E.Message); end; {$ENDIF} end;
  2. Magno

    Trying to share a text file

    Edit: I still didn't find any solution, but the code bellow seems to be "more" correct, I replicate from similar in Java but the message now is like "invalid format", as I am trying to share a text file to WhatsApp, eg. Bellow the new code: if FileExists(FileName) then begin Intent := TJIntent.Create; Intent.setAction(TJIntent.JavaClass.ACTION_SEND); Intent.setType(StringToJString('*/*')); Intent.putExtra(TJIntent.JavaClass.EXTRA_STREAM, StringToJString('content://'+FileName)); SharedActivity.startActivity(TJIntent.JavaClass.createChooser(Intent, StrToJCharSequence('Share with...'))); end;
  3. Hello! Is there any alternative to doc mapping/documenting for Delphi? Thanks
  4. Magno

    DelphiCodeToDoc any alternative?

    πŸ™„ alternative software for DelphiCodeToDoc... I am also accepting 5to9 25$/h if any. Thanks for reply guys, I didn't remember PasDoc and did not know about doc-o-matic, gonna take a look!
  5. Well, I have a panel with 3 labels. My app will geocode reverse (TMaps) some information and I simply need to make it happen (show the address info) after the decoding. Example: procedure Tform.OnGeocodeReverseEvent(const Address: TCivicAddress); begin // these labels are into a Panel labe1.Text := Address.Thoroughfare; labe2.Text := Address.Locality; labe3.Text := Address.CountryName; end; I've tried to force refresh: Panel1.InvalidateRect(RectF(0, 0, Panel1.Width, Panel1.Height)); Also tried create a new "refreshable" panel based on a Stackoverflow example I saw, using SubscribeToMessage(). As expected the geo reverse occurs into a thread (TTask) and after I read the info I need to call the GeocodeReverse() That geoData var bellow simply record that carries some information I will need later, but basically what I need to send to my geoDecode function is just the position (lat/lon), as simplified code: procedure TForm.UpdateInfo(); begin TTask.Run( procedure begin try GetGeoData(); finally TThread.Synchronize(nil, procedure begin UpdateMap(geoData); geoDecode(geoData.Position); end); end; end); end; procedure TForm.geoDecode(Position: TMapCoordinate); var NewLocation: TLocationCoord2D; begin try // Setup an instance of TGeocoder if not Assigned(FGeocoder) then begin // ShowMessage('FGeocoder'); if Assigned(TGeocoder.Current) then FGeocoder := TGeocoder.Current.Create; if Assigned(FGeocoder) then FGeocoder.OnGeocodeReverse := OnGeocodeReverseEvent; end; // Translate location to address if Assigned(FGeocoder) and not FGeocoder.Geocoding then begin // ShowMessage('NewLocation'); NewLocation.Latitude := Position.Latitude; NewLocation.Longitude := Position.Longitude; FGeocoder.GeocodeReverse(NewLocation); end except ShowMessage('Erro ao acessar serviço de geocoder'); end; end; So, after all the OnGeocodeReverse is triggered nicely but the labels themselves will only update if I, e.g. change to another tab, open close the multiviewer, something that force the redraw of the panel.
  6. Magno

    Panel invalidate won't refresh information.

    Well, so far not success. I've even tried to trigger a TTimer just see if would work, but no πŸ˜•
  7. Magno

    Panel invalidate won't refresh information.

    Gonna give a try on that! Thanks so far
  8. My aab file is getting rejected because of that message in the title, the full Google message is: I have compiled, checked everything. Should any obligatory lib be always present? I ask because some of them where removed as they are not really needed. If I open the AAB file I see the 64 and 32 bit file version there. What more should I verify?
  9. I create very new app only to try uploading to Google Store, copied from the old project all the stuff and I getting the same error! "The following APKs or App Bundles are available to 64-bit devices, but they only have 32-bit native code: [4]" Could be something related to the code itself?
  10. I already did it all. The other app I have have no issues with 64 bit. Should be anything else related to the manifest file?
  11. I have such class: type TmyNetHTTPClient = class(TNetHTTPClient) private FileName: String; Index: Integer; Downloaded: Boolean; FileStream: TFileStream; public procedure ReceiveData(const Sender: TObject; AContentLength, AReadCount: Int64; var Abort: Boolean); procedure RequestCompleted(const Sender: TObject; const AResponse: IHTTPResponse); end; Now I create my object and have some similar: // consider filestream already created and other needs for the sake of this example begin myNetHTTPClient := TmyNetHTTPClient.Create(self); myNetHTTPClient.Get('http://localhost/file.txt', FileStream); //myNetHTTPClient.onReceiveData; // error, so commented end; Now, what is I am doing wrong here? The ReceiveData(), and also RequestCompleted() are never triggered πŸ˜• procedure TDownloader.ReceiveData(const Sender: TObject; AContentLength, AReadCount: Int64; var Abort: Boolean); begin doSomething(); end; What should I do to make it work?
  12. YES!!!!! I missed this understanding!! Thank you so much!! πŸ˜„
  13. I never had the real need for this but now I faced I really dunno how, making components are not my real business so here is my doubt, if one would like to help. Well, I have an unit (about.pas) that my compo will use, but this is everything I could do. I have no clue how do go forward. TAbout = Class(TComponent) Private fsAbout: TAbout; Public Procedure AboutDialog; //really? I dunno Published Property About: TAbout Read fsAbout Write fsAbout Stored False; End; procedure TAbout.AboutDialog; begin ShowMessage('Made by me =)'); end; ----- Now, my component has such: private { Private declarations } fsAbout: TAbout; ... published { Published declarations } property About: TAbout Read fsAbout Write fsAbout Stored False; end; And from here I don't know what to do. I would be happy with a read only label on my component too. Thank you for any help! πŸ˜ƒ
  14. Magno

    How to make an "About" for a simple component?

    Thank you guys for all these information! Very useful and one who need can dig on this to make it work for he needs. Remy I will check the Indy approach. My awesome component needs no more than a label informing the version or a ShowMessage() kind of dialog. Thanks again!
  15. Magno

    How to make an "About" for a simple component?

    Thank you!! This is the path I needed.
  16. Magno

    How to make an "About" for a simple component?

    I want that one of the Published properties show an About, with that I can show the user the component version once it get installed in the Delphi IDE. uses uAbout; type TMyComponent = class(TComponent) private { Private declarations } fsAbout: TAbout; FUser: String; protected { Protected declarations } public { Public declarations } published { Published declarations } property About: TAbout Read fsAbout Write fsAbout Stored False; property User: String read FUser write FUser; end; I am stuck here. The TAbout is an external unit, like I show in the OP. So, when installed the User property shows on the IDE and the About, but I don't even know what technique to make it show a dialog or become a read only text. Thanks for the reply!
  17. What I have: a frame with a semi-arc that represents a gauge for information like temperature. See the attached image. Each of these controls are into a frame which I create in runtime depending from what I receive from my server. The structure is: TFrame->TRectangle->TPaintBox. The issue: when I run with Windows the arcs are correctly drawn, I sent the Value so it draws fine the correct gauge. When I run with Android, using the example attached with 3 gauges, all the 3 gauges will get redraw with the same value, even I am pointing to only one. I am using a code I found a modified later, but most of it is close to the original, it will use anti-aliasing to draw the arc, the code is bellow: type TAAArcSettings = record AStart, AEnd, Opacity: single; AThickStart, AThinkEnd: integer; Color: TAlphaColor; end; procedure TframeGauge.DrawArcAA(AParams: TAAArcSettings); var path: TPathData; poly: TPolygon; begin path := TPathData.Create; path.AddArc(rect.CenterPoint, TPointF.Create(rw, rh), AParams.AStart, AParams.AEnd); path.AddArc(rect.CenterPoint(), TPointF.Create(rw - AParams.AThickStart, rh - AParams.AThinkEnd), AParams.AStart + AParams.AEnd, -AParams.AEnd); path.ClosePath(); path.FlattenToPolygon(poly); APaintBox.Canvas.Fill.DefaultColor := TAlphaColorRec.Blue; APaintBox.Canvas.Stroke.Kind := TBrushKind.Solid; APaintBox.Canvas.Fill.Color := AParams.Color; APaintBox.Canvas.FillPolygon(poly, AParams.Opacity); path.DisposeOf; end; I make some calculations to define the initial and final angle plus the percent for the value representation. To intent set a value the code below is used: ArcSetting.AEnd := AEndAngle; ArcSetting.AStart := START_ANGLE; Rectangle1.BeginUpdate; APaintBox.Canvas.BeginScene; APaintBox.Repaint; // this will trigger the PaintBoxPaint() method and there inside I can the DrawArcAAA() APaintBox.Canvas.EndScene; Rectangle1.EndUpdate; There is a procedure TframeGauge.setGaugeValue(Value: integer) which will make the code above. In the main form it detects the frame and will call this procedure, but as I say all of any gauges will be drawn with the new value. This won't happen with Windows (both 32 and 64 bit). Maybe FMX for Android it is required something else beyond I know 😞 Thanks for reading and any clue where I could search for?
  18. Yes, I understand that. Well, using const did not solved. Well, as I said, with Windows it works correctly. With Android once I draw it will replicate the value to any other gauge there. I think it somehow related to the painting method, I really dunno yet.
  19. There was no change on FMX. Maybe if I move to object component I could have more success but for this project I dunno...
  20. I will try move it, thanks but as they are different frames so one should not touch the other...
  21. Yes it is, thank you. I thinking to release it all source code later. The idea behind is simple and it is a quarantine project: I was thinking to monitor some of my computer sensors using WMI queries, but quickly I realise the information about GPU is device dependent on drivers and the time I would expend to accomplish won't be wort. I found a software called Open Hardware Monitor (https://github.com/openhardwaremonitor/openhardwaremonitor) that you can keep it running in background and expands the WMI. Now I have a server that read temps and loads so I can choose what I want to monitor. My computer case has a glass so I could put an old tablet or phone there inside πŸ˜„ Here's more decent screenshot of both client and server (still a WIP).
  22. The code bellow uses FireDac to create a new query object. The if not Assigned() sometimes will bring garbage and make the routine fail because as it reads something, so the "query" won't be created and crashes. procedure createMyQuery(var query: TFDQuery; Sql: String=''); begin if not Assigned(query) then // fail query := TFDQuery.Create(nil); query.Connection := myDatabase; query.SQL.Text := Sql; end; var myQuery: TFDQuery; begin createMyQuery(myQuery,'select * from table'); ... end; Anything I could make it ? The Delphi version is 10.2 update 3.
  23. Yep, but I think the helper with setting nil before is not so handy, but it is ok. This is the way, as I have spoken.
Γ—