Jump to content

programmerdelphi2k

Members
  • Content Count

    1406
  • Joined

  • Last visited

  • Days Won

    22

Everything posted by programmerdelphi2k

  1. have you see the sample on RAD Help ? : Topic "FMXInteractiveGestures (Delphi)" sample to "PAN" ... "Here is the event handler when the GestureID = igiPan"
  2. programmerdelphi2k

    Should Ctrl+Leftclick on inherited work in Delphi 11?

    NOTE: in case of type is privated for "record" for example, Ctrl+Click or Find Declaration, = not found ( ex.: TSplitKind (is a Enum in a Record Helper in the same unit from 'function TStringHelper.InternalSplit((SplitType: TSplitKind...) ) - RAD 11.2
  3. programmerdelphi2k

    Split String

    you can try a home-made like this: Put it in a "unit XXXX" used by your code... if you dont use last IDE, as 10 or 11 else, you can use : MyResult := MyVarWithTextSeparatedByXXX.Split(['-']); // MyResult: TArray<string>; type TMyArrOfStr = array of string; // for easy usage on many places... Note: Delphi use type-name to identify same types on var/object function MySplitStringToArrays(const AValue: string; ASeparator: char = '-'): TMyArrOfStr; var LText : string; i, z : integer; begin result := []; // if Trim(AValue) = '' then exit; // i := 1; // begin repeat z := Pos(ASeparator, AValue, i); if (z > 0) then begin LText := Copy(AValue, i, z - i); i := z + 1; end else begin LText := Copy(AValue, i); end; // if Trim(LText) <> '' then result := result + [LText]; until (z = 0); end; end; procedure TForm1.Button1Click(Sender: TObject); var MyResult: TMyArrOfStr; MyText : string; begin MyText := '-- --'; // hello-world-from-Delphi- -'; // MyResult := MySplitStringToArrays(MyText, '-'); // Memo1.Text := 'Arrays=' + Length(MyResult).ToString; Memo1.Lines.AddStrings(MyResult); end;
  4. programmerdelphi2k

    TDateTimeHelper from D11 that can be used in D10.4?

    In philosophy, we could say that: "Nothing is more obvious than the answer given by someone who never asked!"
  5. programmerdelphi2k

    How to add an item to ComboEdit2 after an item from Comboedit1 has been selected

    Really details it's important, sometimes I dont see it..
  6. programmerdelphi2k

    delphi camera focus

    for me works, and I dont have problem, then... sorry about your "nothing yet right" you can check the distance if > 0 as said in Android Developer! Camera2 specifications!
  7. programmerdelphi2k

    delphi camera focus

    I have used this code in my project and for works, of course you needs know "target cam" to query it implementation {$R *.fmx} uses System.Permissions, FMX.Media.Android, Androidapi.Jni.JavaTypes, Androidapi.Jni.Os, Androidapi.Jni.Hardware, Androidapi.Helpers; procedure TForm1.Button1Click(Sender: TObject); var Camera : JCamera; Params : JCamera_Parameters; FocusModeText : string; FocusModeTextToCompare: string; i, j : integer; begin // TJCamera_Parameters.JavaClass.FOCUS_MODE_AUTO // TJCamera_Parameters.JavaClass.FOCUS_MODE_CONTINUOUS_PICTURE // TJCamera_Parameters.JavaClass.FOCUS_MODE_CONTINUOUS_VIDEO // TJCamera_Parameters.JavaClass.FOCUS_DISTANCE_FAR_INDEX ... TJCamera_Parameters.JavaClass.FOCUS_MODE_MACRO // try i := TJCamera.JavaClass.getNumberOfCameras; // if i > 0 then begin try Camera := TJCamera.JavaClass.open(0); // or 1,2,... whos will be your cam target? // Memo1.Lines.Add('CAM opened... = ' + j.ToString); // Params := Camera.getParameters; if (Params <> nil) then begin FocusModeText := JStringToString(Params.getFocusMode); // "auto", "fixed", ... FocusModeTextToCompare := JStringToString(TJCamera_Parameters.JavaClass.FOCUS_MODE_AUTO); // Memo1.Lines.Add('FocusModeText=' + FocusModeText); Memo1.Lines.Add('FocusModeTextToCompare=' + FocusModeTextToCompare); // if (FocusModeText = FocusModeTextToCompare) then Memo1.Lines.Add('CAM has focus_Auto = ' + i.ToString) else Memo1.Lines.Add('CAM has not focus_Auto = ' + i.ToString); end else Memo1.Lines.Add('Params = nil'); except on E: Exception do Memo1.Lines.Add('CAM opening... ' + E.Message); end; end; except on E: Exception do Memo1.Lines.Add(E.Message); end; end; procedure TForm1.FormCreate(Sender: TObject); begin PermissionsService.RequestPermissions([JStringToString(TJManifest_permission.JavaClass.Camera)], nil, nil); end; end.
  8. programmerdelphi2k

    How to add an item to ComboEdit2 after an item from Comboedit1 has been selected

    NOTE 2: you are ADD value in same ComboEdit2... with ComboEdit2 ???
  9. programmerdelphi2k

    How to add an item to ComboEdit2 after an item from Comboedit1 has been selected

    that way it's better: procedure TForm1.ComboEdit1Change(Sender: TObject); var i: integer; begin i := ComboEdit2.Items.IndexOf(ComboEdit1.Items[ComboEdit1.ItemIndex]); if i = -1 then i := ComboEdit2.Items.Add(ComboEdit1.Items[ComboEdit1.ItemIndex]); // ComboEdit2.ItemIndex := i; end;
  10. programmerdelphi2k

    How to add an item to ComboEdit2 after an item from Comboedit1 has been selected

    TComboBox is VCL and use "GetCount" or you can use "ComboBox1.Items.Count" TComboEdit is FMX (your project is FMX then... ) and use "Count" or "ComboEdit1.Items.Count" NOTE: ComboEdit ONCLICK = click on component (into edit control from it), not on "Items"
  11. programmerdelphi2k

    How to add an item to ComboEdit2 after an item from Comboedit1 has been selected

    Sure what: procedure TForm1.ComboEdit1Change(Sender: TObject); var i: integer; begin i := ComboEdit2.Items.IndexOf(ComboEdit1.Items[ComboEdit1.ItemIndex]); if i = -1 then begin ComboEdit2.Items.Add(ComboEdit1.Items[ComboEdit1.ItemIndex]); ComboEdit2.ItemIndex := ComboEdit2.Count - 1; end else ComboEdit2.ItemIndex := i; end; //--- procedure TForm1.ComboBox1Click(Sender: TObject); if (ComboBox2.Items.IndexOf(ComboBox1.Items[ComboBox1.ItemIndex]) = -1) then begin ComboBox2.Items.Add(ComboBox1.Items[ComboBox1.ItemIndex]); ComboBox2.ItemIndex := ComboBox2.GetCount-1 end; // procedure TForm1.ListBox1Click(Sender: TObject); begin if (ListBox2.Items.IndexOf(ListBox1.Items[ListBox1.ItemIndex]) = -1) then ListBox2.Items.Add(ListBox1.Items[ListBox1.ItemIndex]); end;
  12. programmerdelphi2k

    Object files for Google Snappy C API?

    I have been banned from posting "vague answers" as Admin Lars put it. So I'm not going to use the word "MAYBE" anymore... I have to use "SURE WHAT"
  13. programmerdelphi2k

    Delphi 11.2 HelpInsight Tooltip text color

    sometimes a "hack" is necessary! you can try compare with my Editor HighLight reg --> Edit -> Compare -> Launch Compare Beyond HKEY_CURRENT_USER-SOFTWARE-Embarcadero-BDS-22.0-Editor-Highlight.reg
  14. programmerdelphi2k

    Beep for Firemonkey

    to avoid many "MAP...UnMAP" pixels... var LUseMouseMoveEvent: boolean = true; LBitmap : TBitmap; LBitmapData : TBitmapData; ... procedure TViewMainForm.MyPianoKeyboardMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin LUseMouseMoveEvent := true; // it's ready to play... // LBitmap := MyPianoKeyboard.Fill.Bitmap.Bitmap; // if (LBitmap <> nil) then begin if LBitmap.Map(TMapAccess.Read, LBitmapData) then try MyPlayIt(X, Y); finally LBitmap.Unmap(LBitmapData); end; end; end; procedure TViewMainForm.MyPianoKeyboardMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Single); begin if LUseMouseMoveEvent and (ssCtrl in Shift) then MyPlayIt(X, Y); end; procedure TViewMainForm.MyPianoKeyboardMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Single); begin LUseMouseMoveEvent := false; // dont play anymore LBitmap := nil; end; function TViewMainForm.MyPlayIt(const X, Y: Single): Single; var Xint : integer; Yint : integer; LPixelColor: TAlphaColor; LPlayMyTone: Single; begin result := -1; Xint := Trunc(X); Yint := Trunc(Y); // if (LBitmapData.Data <> nil) then // if mouse-key-down'ED... begin LPixelColor := LBitmapData.GetPixel(Xint, Yint); // LPlayMyTone := MyFindColorTone(LPixelColor); // if LUseMouseMoveEvent and (LPlayMyTone = LLastTonePlayed) then exit; // if (LPlayMyTone > 0) then begin LLastTonePlayed := LPlayMyTone; result := LPlayMyTone; TTone.Play(LPlayMyTone, LPlayDuration); end; end; end;
  15. programmerdelphi2k

    Beep for Firemonkey

    NOTE: the bitmap from Keyboard can be replaced with any other of your choice!
  16. programmerdelphi2k

    Corean write in explorer popup menu

    @Zazhir you can try download the JVCL (JEDI project) and recompile it for your use https://github.com/project-jedi/jvcl jvDialog.pas is here https://github.com/project-jedi/jvcl/tree/master/jvcl/run resoureces: https://github.com/project-jedi/jvcl/tree/master/jvcl/resources
  17. programmerdelphi2k

    Delphi 11.2 HelpInsight Tooltip text color

    just remember that IDE use the files on ...\ObjRepos ( HelpInsight.css and HelpInsight.xml and others ) to config your Code-Insight, and it's possible re-config... but I think that your problem it's just a "IDE setup" as showed above by "Stano"
  18. programmerdelphi2k

    Corean write in explorer popup menu

    well, if you dont have the sources... and can not replace the ".DCU" ( if exists any, used by identify the resource strings), then, I (really) dont know... If "Regional Setting" on MSWindows it's ok... then, the problem would can be the "resource strings" used by Dialog box. the OpenDialog use native dialog from MSWindows, the Delphi just it's a wrap... but I dont know about JV Suite code!
  19. programmerdelphi2k

    The Delphi 11.2 release thread

    no needs big projects... just a little baby "hello world" it's enough! For whatever reason, not specific, the LSP (and consequently, "Code Completion", stop! So, it is necessary to close and open the project! Sometimes, a simple variable assignment with the wrong type already causes the problem. And sometimes, not very often, you can see the message in the IDE that the LSP has stopped and restarted... Then that's it! RAD 11.2 with Patch 1, it's much of the same, and new!
  20. programmerdelphi2k

    TFrameStand Question

    here: if (Key = vkHardwareBack) or (Key = vkEscape) then MSWindows10 - working Android 11 64bit - working ShowMessage(ActiveControl.Name); if not((FService <> nil) and (TVirtualKeyboardState.Visible in FService.VirtualKeyboardState)) then begin Key := 0; Memo1.Lines.Add('TVirtualKeyboardState.Visible in FService.VirtualKeyboardState'); //... TStandFrame downloaded from github : https://github.com/andrea-magni/TFrameStand NOTE: when none Frame is showed and you try "drag to left" again.... (on main screen)... I receive a exception: External Exception E8. Maybe you need verify if you are in main screen in your KeyPress event..
  21. another way, you can try this: all apps should have this param by default: LockingMode=Normal (including IDE) you'll need a refresh for all updates in another apps! procedure TForm1.Button3Click(Sender: TObject); var i: integer; begin FDConnection1.Close; Memo1.Text := FDConnection1.Params.Text + slinebreak; // i := FDConnection1.Params.IndexOfName('LockingMode=Exclusive'); if (i > -1) then FDConnection1.Params[i] := 'LockingMode=Normal' else FDConnection1.Params.Add('LockingMode=Normal'); // Memo1.Lines.Add(FDConnection1.Params.Text); end; // or simply... FDConnection1.Params.Values['LockingMode'] := 'Normal';
  22. programmerdelphi2k

    Access class fields and properties with RTTI

    In fact, no information is generated for "class var/procedure/function" in RAD 11.2 {$M+} TMyClass = class private FPrivatedField: string; procedure FProcedurePrivatedField(const AValue: string); class var FClassVarPrivatedField: string; class procedure FClassProcedurePrivatedField(const AValue: string); static; protected FProtectedField: string; procedure FProcedureProtectedField(const AValue: string); class var FClassVarProtectedField: string; class procedure FClassProcedureProtectedField(const AValue: string); static; public FPublicatedField: string; procedure FProcedurePublicField(const AValue: string); class var FClassVarPublicField: string; class procedure FClassProcedurePublicField(const AValue: string); static; published FPublishedField: TMyPublished; procedure FProcedurePublishedField(const AValue: TMyPublished); class var FClassVarPublishedField: TMyPublished; class procedure FClassProcedurePublishedField(const AValue: TMyPublished); static; public class property ClassVarPrivatedField : string read FClassVarPrivatedField write FClassProcedurePrivatedField; class property ClassVarProtectedField : string read FClassVarProtectedField write FClassProcedureProtectedField; class property ClassVarPublicatedField: string read FClassVarPublicField write FClassProcedurePublicField; class property ClassVarPublishedField : TMyPublished read FClassVarPublishedField write FClassProcedurePublishedField; // property PrivatedField : string read FPrivatedField write FProcedurePrivatedField; property ProtectedField : string read FProtectedField write FProcedureProtectedField; property PublicatedField: string read FPublicatedField write FProcedurePublicField; property PublishedField : TMyPublished read FPublishedField write FProcedurePublishedField; end; {$M-}
  23. better read this https://www.sqlite.org/lockingv3.html as an Embedded DB, it's not allowed more than 1 app access it. when using IDE or debugging, 1 connection will be used for all actions on db.
  24. Python Script dont allow this? https://stackoverflow.com/questions/1373164/how-do-i-create-variable-variables https://stackoverflow.com/questions/13887798/saving-and-recovering-values-of-variables-between-executions
×