Jump to content


Popular Content

Showing content with the highest reputation since 12/26/19 in all areas

  1. David Heffernan

    IDE Screenshot too large?

    https://devblogs.microsoft.com/oldnewthing/20150304-00/?p=44543 https://devblogs.microsoft.com/oldnewthing/20120326-00/?p=8003
  2. With include files one can change the inline option and skip all those IFNDEFs, tested with Berlin and up. In this case the include file includes a CustomInclude.inc, which is part of the project. This makes it simple to edit in the IDE as required. /// <remarks> /// NOTE: You can override this in CustomInclude.inc, but it requires a Build /// and won't update the Blue Dots /// </remarks> {$IFNDEF RELEASE} {-$INLINE OFF} // un-comment as needed {$ENDIF RELEASE}
  3. There's no easy answer to this question, and it's one I've battled with for 20+ years. If it's a trivial change (< 10 min to code and test) and I think it's relevant (not all customer feature requests are, we have to evaluate how they apply to all users) I'll often just go ahead and do it immediately after reading the ticket. It's appreciated by customers, but a double edged sword, the more you do it the more they ask 😉
  4. A.M. Hoornweg

    Bug in Delphi string behavior?

    IMHO the compiler should throw an error if the same parameter is passed multiple times to the method and one of them is an OUT parameter.
  5. You don't have time not to read
  6. Maher Tannous

    Call from sim 2

    Thank you very much this is my working code 1- Use this unit https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.Androidapi.JNI.Telecom.pas 2- procedure CallByPhoneNumber(const PhoneNumber: string; SIMindex: Integer); var Intent: JIntent; LService: JObject; LAccounts: JList; begin LService := TAndroidHelper.Context.getSystemService (TJContext.JavaClass.TELECOM_SERVICE); Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_CALL); Intent.setFlags(TJIntent.JavaClass.FLAG_ACTIVITY_NEW_TASK); Intent.setData(TJnet_Uri.JavaClass.parse(StringToJString('tel:' + JStringToString(TJnet_Uri.JavaClass.encode(StringToJString (PhoneNumber)))))); Intent.putExtra(StringToJString('com.android.phone.force.slot'), true); Intent.putExtra(StringToJString('Cdma_Supp'), true); Intent.putExtra(StringToJString('extra_asus_dial_use_dualsim'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.extra.slot'), SIMindex); Intent.putExtra(StringToJString('slot'), SIMindex); Intent.putExtra(StringToJString('simslot'), SIMindex); Intent.putExtra(StringToJString('sim_slot'), SIMindex); Intent.putExtra(StringToJString('subscription'), SIMindex); Intent.putExtra(StringToJString('Subscription'), SIMindex); Intent.putExtra(StringToJString('phone'), SIMindex); Intent.putExtra(StringToJString('com.android.phone.DialingMode'), SIMindex); Intent.putExtra(StringToJString('simSlot'), SIMindex); Intent.putExtra(StringToJString('slot_id'), SIMindex); Intent.putExtra(StringToJString('simId'), SIMindex); Intent.putExtra(StringToJString('simnum'), SIMindex); Intent.putExtra(StringToJString('phone_type'), SIMindex); Intent.putExtra(StringToJString('slotId'), SIMindex); Intent.putExtra(StringToJString('slotIdx'), SIMindex); Intent.putExtra(StringToJString('simSlotName'), SIMindex); LAccounts := TJTelecomManager.Wrap(TAndroidHelper.JObjectToID(LService)) .getCallCapablePhoneAccounts; if LAccounts <> nil then Intent.putExtra (StringToJString('android.telecom.extra.PHONE_ACCOUNT_HANDLE'), TJPhoneAccountHandle.Wrap(TAndroidHelper.JObjectToID (LAccounts.get(SIMindex)))); TAndroidHelper.Context.startActivity(Intent); end; 3- CallByPhoneNumber(mobilenumber, 0); or CallByPhoneNumber(mobilenumber, 1);
  7. Often the time spent for low priority tickets would better be used for refactoring the code - even if the only benefit is the developers better understanding the code and ease maintaining it. That might not impact your customers directly, but definitely on the long term. First implementing that low priority ticket instead may as well have the opposite effect.
  8. If an object implements many interfaces it handles many responsibilities and not only a single one (SRP). You can use aggregation and delegation of those interfaces.
  9. David Heffernan

    Writing DLL functions unit

    Automatic header convertors tend not to be very effective in my experience. Don't expect to be able to get a working import unit without human intervention.
  10. Indeed, it is! The references are resolved in TReader.FixupReferences and are based on component names. To wire the datasource on the datamodule to the controls on the form, the datamodule has to be created before the form loads. As all forms and datamodules register themselves in the Screen.Forms and Screen.Datamodules lists, they are found by simply iterating over these lists in the Vcl.Forms.FindGlobalComponent procedure, which is registered via RegisterFindGlobalComponentProc. You can register your own FindGlobalComponentProc this way, which takes precedence over the internal one (System.Classes.FindGlobalComponents uses a reverse loop). The implementation might be a bit tricky, though.
  11. Daniel

    Topics are showing not condensed

    In german language, we call this "putzig": It is indeed an error in the forums-software related to the recent change of the year. So kind of a "year 2020 bug". I do have a bugfix and will it apply this evening. Other customers reported a successful patch - so I think it will work here also.
  12. Anders Melander

    Kill a thread ... dead

    Variations of this question has been asked countless times. Always with the same answer: Don't do it. Why would you expect a different advice this time? Move the conversion into a separate process and kill that process instead.
  13. Wow. After so many years of working with Delphi I have just noticed that you can paste code into the watch list 🤪 Or did I install some experts?
  14. Unless someone has done it already, I expect you're going to need to spend a fair amount of time on it. This is a starting point for the leaderboard/game saving parts: https://developers.google.com/games/services/android/leaderboards It would be a case of: Reading the documentation, and working out which parts you want to implement Working out which packages the relevant classes are in Doing imports of those classes into Delphi code Working out whether there are any classes you need to create descendants for, and writing the appropriate Java and associated Delphi code for them Implementing the various parts in Delphi Alternatively, you could implement a large portion of it in Java, create a .jar that Delphi would use and import the relevant parts into Delphi code. I note that it requires Google Sign-in, so for that part you might want to take a look at this: https://github.com/grijjy/DelphiGoogleSignIn Which is related to Firebase, however the Google Sign-In parts would be relevant.
  15. Dave Nottage

    Call from sim 2

    Your code does not match the Java equivalent that has been sent to you. This is the equivalent: uses Androidapi.JNI.GraphicsContentViewText, Androidapi.JNI.Net, Androidapi.Helpers; procedure TForm1.Button1Click(Sender: TObject); var MobileNumber: string; Intent: JIntent; begin MobileNumber := '*155#'; Intent := TJIntent.JavaClass.init(TJIntent.JavaClass.ACTION_CALL); Intent.putExtra(StringToJString('com.android.phone.extra.slot'), 1); Intent.putExtra(StringToJString('simSlot'), 1); Intent.setData(TJnet_Uri.JavaClass.parse(StringtoJString('tel:' + MobileNumber))); TAndroidHelper.Context.startActivity(Intent); end; I don't have a dual SIM device to test this. Those are not equivalent. TJIntent.JavaClass.EXTRA_PHONE_NUMBER is "android.intent.extra.PHONE_NUMBER", not "com.android.phone.extra.slot"
  16. Yaroslav Brovin

    New section for native apps

    Flutter is interesting. Instant run, interesting language. BUT, we love Delphi for good and convenient working with DB, incredibly fast creating UI mock. And I'm sure the biggest part of developers in this forum has a lot of existing Delphi code, which is very interesting to run in mobile platforms. So I believe Flutter is not a magic bullet. I'll say the obvious thing, but each technologies has advantages and disadvantages for each project. So everybody select solution based on his own preferences.
  17. Primož Gabrijelčič

    Generic Command Line Parser for Delphi 10.3.x

    My approach: https://github.com/gabr42/GpDelphiUnits/blob/master/src/GpCommandLineParser.pas
  18. Kas Ob.

    Some assistance on SSL required

    Ditch PEM and use p12 ( same as pfx)
  19. Dave Nottage

    Squint and read: CreateFormFromStings

    Not that it would affect many users (if any), but in FMX.Edit.Style: protected FNeedChange: Boolean; procedure Change; virtual; { Messages From Model} procedure MMSelLenghtChanged(var AMessage: TDispatchMessageWithValue<Integer>); message MM_EDIT_SELLENGTH_CHANGED; procedure MMSelStartChanged(var AMessage: TDispatchMessageWithValue<Integer>); message MM_EDIT_SELSTART_CHANGED; procedure MMCheckSpellingChanged(var AMessage: TDispatchMessageWithValue<Boolean>); message MM_EDIT_CHECKSPELLING_CHANGED; Spot the typo. The last method name pictured is ironic. Someone should whip up a "spell checker" (of sorts) to see how many of these there are 😉
  20. David Heffernan

    Kill a thread ... dead

    You can't kill it reliably and robustly. You can kill it, but expect consequences in your process.
  21. What about breaking down the menu into groups? Yes, it is convenient to have everything on top level ... until it isn't. Since I don't use GExperts, my grouping suggestion is only based on menu names, not on actual functionality - so some placements may be totally wrong. File Code Librarian Code Proofreader ... Favorites Open Project Backup ... Class Browser Dependencies Source Export Component Copy Names Find Reference Grid ... Hide / Show Non.-Visual Rename Replace Select Set FocusControl Set Tab Order ... To Code Editor Bookmarks Comment Empty Code Blocks Clipboard History Experts Focus Go to Grep Next Item Previous Item Results Search ... Macro Library Playback Record Start/Stop Tools Ascii Chart IDE Menu Shortcuts... Keyboard Shortcuts Message Dialog PE Information To Do List -- Configuration About Window Add Dock Window Reselect Desktop
  22. Dave Nottage

    Call from sim 2

    I've created a more compatible (with the other Delphi units) import for the Telecom classes, here: https://github.com/DelphiWorlds/KastriFree/blob/master/API/DW.Androidapi.JNI.Telecom.pas Which should at least make it a bit easier
  23. In my case (self-employed) this is actually wanted/needed as it means the customer is engaged and more chance it will be a long time customer.
  24. I tried to keep the post as short as possible, but I guess it won't be possible My English is not very technical (or good), I must use some examples to help me explain. The client side platform has "ready to use frames" with editors placed at design time. Some frames are easy to create at runtime, I won't talk about those. Others not so easy (Customer, Orders, Contract, Services, Billing etc). So I derive from the my baseFrame and drop the corresponding controls at Design time. This is almost the only thing I can do. My users have different monitor resolutions, some have some sight problems, and sometimes Windows cannot natively display some information in a way they can read it. So in my application offer them a way to choose their favorite fonts and font sizes (some of them uses Tahoma 20 bold for normal label/editors). For this reason, I must resize the form in order to fit them as "designed". There other factors too, like for example skins (Some customer want me to design skin to match their logo, company colors and stuff ). Anyway, this is strictly handled on the client side. But as any other application there are some restrictions applied to users ( or modules). Fields they can't edit, or fields they can't see. Those are the definitions coming from the server. At server side, there are some "hard validation rules", like for example StartDate must be Less or equal do EndDate. This kind is still hard coded and I guess this falls into your strong binding UI Definition. I try to keep those to a minimum. But there are some soft rules that applies depending on the user ( or module ). For example, I must check if document number is valid when editing data on Module A, but that same document is optional for Module B, so no validation is required. Yet again, this rule can apply to Customer A, but Customer B wants both modules A and B to validate the document number. The way I implemented it all I have to do assign the "IsRequired" for that particular document number field of module A and Module B accordingly to that customer needs. The server side platform (REST API with JSON) is handling complex requests (Definition + Data) only from my client side platform. Third party system integrate with my server platform using another authorization scheme and a different REST API route. No UI Presentation to deal with. So far, no customer requested complex browser features. The mobile side is pretty simple too. Data entry is not practical at all so the UI must be very well thought, objective, touchy, battery and processor friendly. The only thing the app receives is Data, no definition or maybe some soft rules definition to display some nice glyph to the user in the next few months. Mobiles get their own set of "forms". This was a way I found to deal with all this UI presentation logic. This is just an example to help illustrate. I'm sure there are better ways to manage it, that's why I like it here! Always learning a better way to implement things Clément
  25. Rollo62

    Request for advice: FireMonkey and Frames

    This works well for me in many places procedure Frame_Embed_To(const AFrame : TFrame; const ACarrier : TControl); begin if Assigned( ACarrier ) and Assigned( AFrame) then begin ACarrier.BeginUpdate; try AFrame.Parent := nil; AFrame.Parent := ACarrier; AFrame.Align := TAlignLayout.Client; finally ACarrier.EndUpdate; ACarrier.Repaint; end; end; end; procedure Frame_Embed_ReleaseFrom(const AFrame : TFrame; const ACarrier : TControl); begin if Assigned( ACarrier ) and Assigned( AFrame) then begin ACarrier.BeginUpdate; try AFrame.Parent := nil; finally ACarrier.EndUpdate; ACarrier.Repaint; end; end; end;