Category: StackOverflow

what are the definition of the placeholders found in Entitlement.TemplateiOS.xml?

what are the definition of the placeholders found in Entitlement.TemplateiOS.xml under delphi Rio ? <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <%getTaskAllowKey%> <%applicationIdentifier%> <%pushNotificationKey%> <%keychainAccessGroups%> </dict> </plist>
Read More

TWebBrowser throwing thread exception when loading html from string

I'm developing an app that loads a HTML string into a WebBrowser, but when I call the LoadFromString methods from WebBrowser, it throws a RuntimeException with the message: java.lang.RuntimeException: java.lang.Throwable: A WebView method was called on thread 'Thread-2'. All WebView methods must be called on the same thread. (Expected Looper Looper (main, tid 2) {c7ba400} called on null, FYI main Looper is Looper (main, tid 2) {c7ba400}) The HTML is stored in a file and loaded into a string just for test reasons, the final app will get the string from a DataSnap and show it using WebBrowser. This is the code: procedure LoadString; var htmlContent: String; filePath: String; dbpath: String; begin filePath := TPath.Combine(TPath.GetDocumentsPath, 'index.html'); htmlContent := TFile.ReadAllText(filePath); WebBrowser1.LoadFromStrings(htmlContent, 'about:blank'); btnSearch.Visible := False; TabControl1.GotoVisibleTab(tbResult.Index); end; I'm not using thread in this app. If relevant, I'm using Delphi 10.1 Berlin and testing in a Moto G5 with Android 9.
Read More

how to setup the value for com.apple.developer.associated-domains in MyApp.entitlements?

When I try to upload my app (made with delphi Rio) to the appStore I have this error message: ERROR ITMS-90046: "Invalid Code Signing Entitlements. Your application bundle's signature contains code signing entitlements that are not supported on iOS. Specifically, value '*' for key 'com.apple.developer.associated-domains' in 'Payload/myapp.app/myapp' is not supported." then I look in the myApp.entitlements that Delphi generate and I have: <key>com.apple.developer.associated-domains</key> <string>*</string> But the problem I don't see where I can change this value? it's seam it's the "*" who make a problem, but don't see where I can change it
Read More

iOS: how to add a title to a date picker dialog

I would like to add a title to a Date Picker Dialog. This is how I create the date picker dialog : // We should Create instance of UIDatePicker before creating main container. // Because We use UIViewPicker for determinate finally size of picker container // (Toolbar + Picker) FUIDatePicker := TUIDatePicker.Create; FUIDatePicker.setTimeZone(TNSTimeZone.Wrap(TNSTimeZone.OCClass.timeZoneForSecondsFromGMT(0))); FUIDatePicker.setDatePickerMode(UIDatePickerModeDate); { Subscribing to change orientation events } DefaultNotificationCenter.addObserver(GetObjectID, sel_getUid('DeviceOrientationChanged'), StringToID(FMXViewControllerFrameChanged), nil); { Creating Root view container for picker } FUIOverlayView := TUIView.Create; aUIColor := AlphaColorToUIColor($32000000); FUIOverlayView.setBackgroundColor(aUIColor); FUIOverlayView.setAutoresizingMask(UIViewAutoresizingFlexibleWidth or UIViewAutoresizingFlexibleHeight or UIViewAutoresizingFlexibleLeftMargin or UIViewAutoresizingFlexibleRightMargin or UIViewAutoresizingFlexibleTopMargin or UIViewAutoresizingFlexibleBottomMargin); FUIOverlayView.setFrame(CGRect.Create(0, 0, screen.Size.Width, screen.Size.Height)); aSingleTapGestureRecognizer := TUITapGestureRecognizer.Wrap(TUITapGestureRecognizer.Alloc.initWithTarget(GetObjectID, sel_getUid('HandleTap'))); aSingleTapGestureRecognizer.setDelegate(GetObjectID); aSingleTapGestureRecognizer.setNumberOfTapsRequired(1); try FUIOverlayView.addGestureRecognizer(aSingleTapGestureRecognizer); finally aSingleTapGestureRecognizer.release; end; { Creating Root view container for picker } FUIContainerView := TUIView.Create; FUIContainerView.setBackgroundColor(TUIColor.Wrap(TUIColor.OCClass.whiteColor)); FUIContainerView.setAutoresizingMask(UIViewAutoresizingFlexibleWidth or UIViewAutoresizingFlexibleLeftMargin or UIViewAutoresizingFlexibleRightMargin); FUIContainerView.setFrame(GetPopupFrame); FUIContainerView.layer.setMasksToBounds(true); FUIContainerView.layer.setCornerRadius(12); { Creating Toolbar } FUIToolBar := TUIToolbar.Create; FUIToolBar.setAlpha(0.8); FUIContainerView.addSubview(FUIToolBar); CreateToolbarConstraint; { Creating Toolbar buttons } aButtons := TNSMutableArray.Create; try { Adding Flexible Separator } FUIFlexibleSepararator1 := TUIBarButtonItem.Create; FUIFlexibleSepararator1.initWithBarButtonSystemItem(UIBarButtonSystemItemFixedSpace, nil, nil); FUIFlexibleSepararator1.setWidth(5); aButtons.addObject(NSObjectToID(FUIFlexibleSepararator1)); { Adding clear Button } if aBtnClearCaption <> '' then begin FUIClearButton := TUIBarButtonItem.Create; FUIClearButton.setTitle(StrToNSStr(aBtnClearCaption)); FUIClearButton.setStyle(UIBarButtonItemStyleBordered); FUIClearButton.setTarget(Self.GetObjectID); FUIClearButton.setAction(sel_getUid('Clear')); aButtons.addObject(NSObjectToID(FUIClearButton)); end else FUIClearButton := nil; { Adding Flexible Separator } FUIFlexibleSepararator2 := TUIBarButtonItem.Create; FUIFlexibleSepararator2.initWithBarButtonSystemItem(UIBarButtonSystemItemFlexibleSpace, nil, nil); aButtons.addObject(NSObjectToID(FUIFlexibleSepararator2)); { Adding Close Button } if aBtnCancelCaption <> '' then begin FUICancelButton := TUIBarButtonItem.Create; FUICancelButton.setTitle(StrToNSStr(aBtnCancelCaption)); FUICancelButton.setStyle(UIBarButtonItemStyleBordered); FUICancelButton.setTarget(Self.GetObjectID); FUICancelButton.setAction(sel_getUid('Cancel')); aButtons.addObject(NSObjectToID(FUICancelButton)); end else FUICancelButton := nil; { Adding Flexible Separator } FUIFlexibleSepararator3 := TUIBarButtonItem.Create; FUIFlexibleSepararator3.initWithBarButtonSystemItem(UIBarButtonSystemItemFixedSpace, nil, nil); FUIFlexibleSepararator3.setWidth(28); aButtons.addObject(NSObjectToID(FUIFlexibleSepararator3)); { Adding Done Button } FUIDoneButton := TUIBarButtonItem.Create; FUIDoneButton.setTitle(StrToNSStr(aBtnOKCaption)); FUIDoneButton.setStyle(UIBarButtonItemStyleDone); FUIDoneButton.setTarget(Self.GetObjectID); FUIDoneButton.setAction(sel_getUid('Done')); aButtons.addObject(NSObjectToID(FUIDoneButton)); { Adding Flexible Separator } FUIFlexibleSepararator4 := TUIBarButtonItem.Create; FUIFlexibleSepararator4.initWithBarButtonSystemItem(UIBarButtonSystemItemFixedSpace, nil, nil); if aBtnClearCaption <> '' then FUIFlexibleSepararator4.setWidth(5) else FUIFlexibleSepararator4.setWidth(15); aButtons.addObject(NSObjectToID(FUIFlexibleSepararator4)); { Adding button to Toolbar } FUIToolBar.setItems(aButtons); finally aButtons.release; end; { Adding DatePicker } FUIContainerView.addSubview(FUIDatePicker); CreateCalendarConstraint; FUIOverlayView.addSubview(FUIContainerView); and {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure CreateToolbarConstraint; var Constraint: NSLayoutConstraint; begin FUIToolBar.setTranslatesAutoresizingMaskIntoConstraints(False); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIToolBar), NSLayoutAttributeLeft, NSLayoutRelationEqual, NSObjectToID(FUIContainerView), NSLayoutAttributeLeft, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIToolBar), NSLayoutAttributeRight, NSLayoutRelationEqual, NSObjectToID(FUIContainerView), NSLayoutAttributeRight, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIToolBar), NSLayoutAttributeBottom, NSLayoutRelationEqual, NSObjectToID(FUIContainerView), NSLayoutAttributeBottom, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIToolBar), NSLayoutAttributeHeight, NSLayoutRelationEqual, nil, NSLayoutAttributeNotAnAttribute, 1, _ToolBarHeight)); Constraint.setActive(True); end; {~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~} procedure CreateCalendarConstraint; var Constraint: NSLayoutConstraint; begin FUIDatePicker.setTranslatesAutoresizingMaskIntoConstraints(False); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIDatePicker), NSLayoutAttributeLeft, NSLayoutRelationEqual, NSObjectToID(FUIContainerView), NSLayoutAttributeLeft, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIDatePicker), NSLayoutAttributeRight, NSLayoutRelationEqual, NSObjectToID(FUIContainerView), NSLayoutAttributeRight, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIDatePicker), NSLayoutAttributebottom, NSLayoutRelationEqual, NSObjectToID(FUIToolBar), NSLayoutAttributetop, 1, 0)); Constraint.setActive(True); Constraint := TNSLayoutConstraint.Wrap(TNSLayoutConstraint.OCClass.constraintWithItem(NSObjectToID(FUIDatePicker), NSLayoutAttributeHeight, NSLayoutRelationEqual, nil, NSLayoutAttributeNotAnAttribute, 1, _DefaultPickerHeight)); Constraint.setActive(True); end; Any idea what i need to change in this code in order to add a title ?
Read More

How to use Image1.Bitmap.BitmapChanged;

Bitmap.BitmapChanged; is protected in FMX.Graphics so I cannot use the procedure. Useing a TImage or TImageControler I am drawing a line but the line does not show. I am using this snippet: imgc1.Bitmap.Canvas.BeginScene; imgc1.Bitmap.Canvas.DrawLine(FStartPoint,FEndPoint, 100); imgc1.Bitmap.Canvas.EndScene; imgc1.Bitmap.BitmapChanged; // the original example said that this would redraw the image. In my CE Rio IDE the BitmapChanged is undefind. How can I use it? Draw the line. IDE cannot find BitmapChanged.
Read More

convert vcl project to fmx Delphi 10.3

I try to use Listview in my fmx project , and grab text from it Like vcl , How can I using it in fmx project not in vcl ? procedure TForm1.Button1Click(Sender: TObject); var item: TListItem; begin item := ListView1.Items.Add; item.Caption := 'Mohamed'; item.SubItems.Add('Akram'); item.SubItems.Add('055002011'); item.ImageIndex := 0; end; procedure TForm1.CaptionclickClick(Sender: TObject); begin Memo1.Lines.Add('caption : ' + ListView1.Items[ListView1.Selected. Index].Caption); end; procedure TForm1.FirstitemclickClick(Sender: TObject); begin Memo1.Lines.Add('First sub item : ' + ListView1.Items[ListView1.Selected. Index].SubItems[0]); end; procedure TForm1.SeconditemclickClick(Sender: TObject); begin Memo1.Lines.Add('Second sub item : ' + ListView1.Items[ListView1.Selected. Index].SubItems[1]); end; https://6.top4top.net/p_1260py56w1.jpg
Read More

How to bring a TreeViewItem in the visible (scroll) area

I'm looking for a way to navigate by code to an item in a tree view. The object should be moved into the visible area. I could not find a method in either TTreeView or TTreeViewItem. The following approach does not work under all circumstances because the item position is not always updated: procedure TfmxMain.MakeItemVisible(Item: TTreeViewItem); begin trvMyTreeView.ViewportPosition := TPointF.Create(min(Item.Position.X - trvSlideGroups.ClientWidth / 2, 0), min(Item.Position.Y - trvSlideGroups.ClientHeight / 2, 0)); end;
Read More