Category: StackOverflow

LiveBinding value can not be set by code

There is a TToolbar, which has it's value bound to a TText.Text. If I change the TToolbar value, the TText.Text is changed as well. So far everything works ok. If I set the TToolbar value manual, the Binding does not affect: The TToolbar value changes, but the Text does not. Is there a way to trigger the LiveBinding by code? Of course I can set the TToolbar.Value and TLabel.Text separately manual, as decommented in the code below, but this would mean - prone to failure due redundant code in setting the Label1.Text - not very comfortable on more complex LiveBinding situations Sample Delphi FMX Code: unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Graphics, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.StdCtrls, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti, System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components, FMX.Objects; type TForm1 = class(TForm) TrackBar1: TTrackBar; Text1: TText; Button1: TButton; BindingsList1: TBindingsList; LinkControlToPropertyText: TLinkControlToProperty; procedure Button1Click(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.Button1Click(Sender: TObject); begin TrackBar1.Value := 11; // bad workaround: // Text1.Text := Format('%n',[TrackBar1.Value]); end; end. According Unit1.FMX: object Form1: TForm1 Left = 0 Top = 0 Caption = 'Form1' ClientHeight = 480 ClientWidth = 640 FormFactor.Width = 320 FormFactor.Height = 480 FormFactor.Devices = [Desktop, iPhone, iPad] DesignerMobile = False DesignerWidth = 0 DesignerHeight = 0 DesignerDeviceName = '' DesignerOrientation = 0 DesignerOSVersion = '' object TrackBar1: TTrackBar Frequency = 1.000000000000000000 Height = 20.000000000000000000 Orientation = Horizontal Position.X = 32.000000000000000000 Position.Y = 64.000000000000000000 TabOrder = 1 Width = 100.000000000000000000 end object Text1: TText Height = 25.000000000000000000 Position.X = 152.000000000000000000 Position.Y = 64.000000000000000000 Width = 137.000000000000000000 end object Button1: TButton Height = 22.000000000000000000 Position.X = 32.000000000000000000 Position.Y = 96.000000000000000000 TabOrder = 3 Text = 'Button1' Width = 80.000000000000000000 OnClick = Button1Click end object BindingsList1: TBindingsList Methods = <> OutputConverters = <> Left = 20 Top = 5 object LinkControlToPropertyText: TLinkControlToProperty Category = 'Schnelle Bindungen' Control = TrackBar1 Track = False Component = Text1 ComponentProperty = 'Text' end end end
Read More

Firemonkey HD Form will not Minimize when using the Taskbar

I have a Firemonkey HD application targeted for the 32-bit Windows platform. Clicking the applications Minimize button from within the Form works as expected and will restore when its taskbar button is clicked, however it will not Minimize this way. I can only Minimize from within the Form. The Windows live preview thumbnail will also not display the Form when it is hovered over with the mouse. This happens with just a blank new Firemonkey HD application and I get the same behaviour in Windows XP Professional, Windows 7 Ultimate and Windows 8 I thought at first it could be due to the MainFormOnTaskbar property however this I found out does not apply to Firemonkey and cannot be used. Is this some limitation of Firemonkey? Why does this happen?
Read More

Delphi Xe6 Android – Google Maps Pin text import in editbox

I am working on simple app that: 1. Loads google map with several location pins within android mobile browser. 2. When user taps on some pin I show him pin text (infowindow) and pin text is actually a phone number. That works ok. Is it possible to import pin text content from mobile browser to editbox on some form when user taps on pin? Then I can let user initiate phone call using the number from editbox
Read More

How can I Differentiate between OnClick and Swipe on a Firemonkey TListView Item with Delphi XE6

I have a form with a TListView on it. I load up some items, and it displays fine. If I tap (OnClick) an item, I can display a second form with the item details, and some additional options. However, if I swipe right (to activate the "Delete" button), I get the OnClick event, and the detail form displays. When I close the Detail form (or use the "Back" button), the TListView now has the Delete button displayed. So, the short version of this is how can I stop the OnClick event from firing when a Swipe is done? I've tried adding a flag, and setting the flag in the OnDeleteChangeVisible, and/or OnGesture, but the flag never seems to get set, and I don't see these events firing when I run in debug mode. var isDelete: Boolean procedure TfrmTaskList.lvTaskListDeleteChangeVisible(Sender: TObject; AValue: Boolean); begin if (AValue = True) then isDelete := True else isDelete := False; end; procedure TfrmTaskList.lvTaskListGesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean); begin if (EventInfo.GestureID = sgiRight) then begin isDelete := True end else begin isDelete := False; end; end; Any help, advice, resources would be greatly appreciated. Thanks
Read More

Firemonkey (iOS & Android) File Type Association

I have searched the web for this and have found bits and pieces of how to put this together, but nothing that seems to work. My application writes .soc files (new file type that just contains text) and saves them. I would like to be able to share these files and thus when someone downloads this file and tries to open it my application will be an option to "Open this file with" on their mobile device. What do I need to add to my code to get this to work on both Android and iOS?
Read More

delphi xe6 firemonkey change form style runtime

hello how can i change (delphi firemonkey mobile application) stylebook runtime i will try load from ini or text file when formcreate or formshow but cannot work stylename is string i was try this code but code1 work but code 2 cannot work if RadioButton1.IsChecked then Form1.StyleBook:=white else Form1.StyleBook:=black; i need form1.stylebook:= trim(Copy(Memo2.Lines.Strings[0],7,30)); {string ='black'} but error code :[dcc32 Error] main.pas(226): E2010 Incompatible types: 'TStyleBook' and 'string'
Read More

How select TComboBox item on Mac with Firemonkey?

I have a TComboBox with several Strings in its Items list. When run on Windows, this works properly - I am able to click the combo-box, have the items appear, and then select one of the items. When I set the OS target to OS X, however, the TComboBox does not allow me to select an item. I can click the TComboBox and have the items appear, but when I try to click an item from the drop-down list I receive a 'bump' sound on the Mac, and nothing is selected. How can I get TComboBoxes to work properly on the Mac using Firemonkey? I am using C++ Builder XE6 with FMX (Firemonkey).
Read More

Delphi xe6 app freezes/unresponsive when rotating actual device

Using Delphi xe6 for an iOS application. On an actual device, when a user rotates the screen, sometimes the app becomes non responsive or crashes/closes. Not sure how to go about debugging this because no such error happens on a simulator when debugging. No code in the onPaint,onActivate,onCreate or onResize events of an example problem form but I do have this, however, in the onActivate event handler. ... if (TPlatformServices.Current.SupportsPlatformService(IFMXScreenService, IInterface(ScreenSvc))) and ((Max(ScreenSvc.GetScreenSize.X, ScreenSvc.GetScreenSize.Y)=1024) or (Max(ScreenSvc.GetScreenSize.X, ScreenSvc.GetScreenSize.Y)=2048)) then begin TLoginBox.Align := TAlignLayout.alCenter; TLoginBox.Width := 300; end else TLoginBox.Align := TAlignLayout.alClient; Any help in the right direction would be much appreciated.
Read More

TNumberBox behavior changed from Delphi XE5 to XE6

In XE5 the Number Box could be totally cleared by using the Back Space button. In XE6 this behavior has changed so that the Back Space button no longer clears the entire Edit Box but leaves the last number to be deleted (which is the Min property value). This behavior makes it more difficult to enter values. Is there a way to revert back to the XE5 behavior? Example: Place a TNumberBox on a mobile form and set Min property to 18 and the Max property to 65. Run the program and try to change the value to 25 using only the keyboard.
Read More