-
Content Count
1406 -
Joined
-
Last visited
-
Days Won
22
Everything posted by programmerdelphi2k
-
Radio Button and Check Box font color not changing with parent..
programmerdelphi2k replied to Jeff Steinkamp's topic in VCL
@Jeff Steinkamp unfortunatelly, now all is "Themed" then, just uncheck "enable runtime themes" in your project and change the colors... -
search between two dates
programmerdelphi2k replied to Analyste2023's topic in RTL and Delphi Object Pascal
using "Between" dates: Using "PARAMetrizations" in your FDQuery for example: procedure TForm1.Button1Click(Sender: TObject); begin SalesTable.Close; SalesTable.ParamByName('DateBegin').AsDate := StrToDate('06/01/2023'); SalesTable.ParamByName('DateEnd').AsDate := StrToDate('06/30/2023'); SalesTable.Open; end; -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
on msg, a simple sample using Singleton project -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
how the message will be processed when received? said, who send? who read? the messages, what object is it? (string/object/etc...) is thread-safe or what? -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
@SgtZdog is possible show the skeleton this class, for curiosity? -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
@SgtZdog of course, my props was more to show, not to use. as I dont know exactly what you expect ... as any log-system I think that a Singleton Pattern as "container" would can be used as your repository of messages, or a Observer Pattern... -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
@SgtZdog unit uParentClass; interface type TParentClass = class protected // now, this class can to be used as any other... directly or inherited! function PleaseOverrideMeIfWant: string; virtual; // no needs to be overrided on subclasses! end; implementation { TParentClass } function TParentClass.PleaseOverrideMeIfWant: string; begin result := 'hello, im TParentClass definition'; end; end. -------------- child ----------------- unit uChildClass; interface uses uParentClass; type TChildClassInheritingFromParent = class(TParentClass) private function GetPleaseOverrideMeIfWant: string; protected function PleaseOverrideMeIfWant: string; override; // overriding ancestral function... public property ReadMyProtectMethodOverrited : string read PleaseOverrideMeIfWant; property ReadMyProtectMethodNoOverrited: string read GetPleaseOverrideMeIfWant; end; implementation { TChildClassInheritingFromParent } function TChildClassInheritingFromParent.GetPleaseOverrideMeIfWant: string; begin result := inherited PleaseOverrideMeIfWant; // using ancestral... end; function TChildClassInheritingFromParent.PleaseOverrideMeIfWant: string; begin result := 'hello, im TChilClass definition overriding TParentClass definition...'; end; end. ------------------- form1 -------------- implementation {$R *.dfm} uses uChildClass; procedure TForm1.Button1Click(Sender: TObject); var LChilClass: TChildClassInheritingFromParent; begin LChilClass := TChildClassInheritingFromParent.Create; try Memo1.Lines.Add(LChilClass.ReadMyProtectMethodOverrited); // Memo1.Lines.Add(LChilClass.ReadMyProtectMethodNoOverrited); finally LChilClass.Free; end; end; initialization ReportMemoryLeaksOnShutdown := true; end. -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
class function ChildClass.Maker() : ChildClass; begin Result := inherited Create(); // calling "ancestral Create" as Child result? ... some sense here? ... end; if "Child" inherit from "Parent", why call "Create from Parent as a result as Child"? if "Maker" is a class method, then why create a instance as Child, if class method does not needs any creation? if was ok, remember: "Parent" has a "abstract method" that needs to be implmented on "Child" confused not? -
Static Method in Child Class Access Protected Parent Member
programmerdelphi2k replied to SgtZdog's topic in Algorithms, Data Structures and Class Design
@SgtZdog ParentClass: it's a class like any other! no problem! BUT, it has a "virtual/abstract" method!!! --- so this says that the "subclasses" must "mandatory" implement it, otherwise you'll have an access violation when in use!!! --- but fortunately, (should) an exception will be created during the usage of "ChildClass", showing the "abstract method" never implemented in the subclasses!!! In general, I think it's not right for your classes, because "ChildClass" intends to use a method defined in "ParentClass", but "ParentClass" doesn't implement that method and requires it to be implemented by subclasses... I think we have a " impasse" here no? Now, if the "subclasses" implement this method, "it" does not belong to the "ParentClass", but to the "ChildClasses"!!! Another problem to take into account is mixing "common method" with "class method". Remembering that the "class methods" belong to the class, and will be accessible to any number of instances of objects created from the "Childclass". That is, they can be read, written, etc... by any objects of this "ChildClass" hierarchy. Another factor, too, is the accessibility between "common methods" and "class methods", that is, the conversation between them, internally! unit uParentClass; interface type TParentClass = class protected // a "common method" function MethodWhatHappensHere: string; virtual; abstract; // it will be implemented on subclasses! end; implementation end. // ------------ unit uChildClass ----------------- interface uses uParentClass; type TChilClassUsingInheriting = class(TParentClass) protected // it's mandatory implement it here! -- uncomment it!!! // function MethodWhatHappensHere: string; override; // implementing... --- E2362 Cannot access protected symbol "xxxxxxxxx" directly public function ShowSomeMessage: string; // now, it's possible! end; implementation { TChilClassUsingInheriting } function TChilClassUsingInheriting.ShowSomeMessage: string; begin // if "MethodWhatHappensHere" was not defined in this subclass, then the "ancestral" will be used anyway! // result := {inherited} MethodWhatHappensHere; // using "inherited" you call the "ancestral" method, BUT remember: there, it is "abstract"!!! //result := { Self. } MethodWhatHappensHere; // using "Self." it's ok if was defined on "ChildClass"!!! end; // function TChilClassUsingInheriting.MethodWhatHappensHere: string; // begin // result := 'I dont know! from: ' + Self.ClassName; // end; end. // -------- form1 --------- implementation {$R *.dfm} uses uChildClass; procedure TForm1.Button1Click(Sender: TObject); var LChildClass: TChilClassUsingInheriting; begin // Unit1.pas(42): W1020 Constructing instance of 'TChilClassUsingInheriting' containing abstract method 'TParentClass.MethodWhatHappensHere' LChildClass := TChilClassUsingInheriting.Create; try LChildClass.ShowSomeMessage; finally LChildClass.Free; end; end; -
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
can you show it? in code and moving? (like above)- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
@MikeZ87 sometimes you need to do a little "hack" ... if possible... look, StyleBook + Hacking class TComboListBox used by ComboBox in FMX ListBox using ItemHeight = 100 ComboBox using (ListBox) ItemHeight = 60 + colors- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
@MikeZ87 well, the "Styles" (old Skins, Themes, etc....) is a new way to put "color and actions" on GUI of apps, and honestly, it's a black box with too many ramifications to venture to master it!.. to understand a little more you needs use a StyleBook and testing each elements... you can "copy" all elements started with "listbox..." found in any Style like I said above... and search each "text" object and test it...- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
Determine if a stringgrid has ssboth or sshorizontal scrollbars defined
programmerdelphi2k replied to alogrep's topic in VCL
unit Vcl.StdCtrls.pas and System.UITypes.pas (new IDE) -
Determine if a stringgrid has ssboth or sshorizontal scrollbars defined
programmerdelphi2k replied to alogrep's topic in VCL
@alogrep maybe this way help you better no? // TScrollStyle = System.UITypes.TScrollStyle deprecated 'Use System.UITypes.TScrollStyle'; implementation {$R *.dfm} uses System.TypInfo; type TMyScrollStylesSetOfValues = set of TScrollStyle; // if does not exists, we can create it! TMyHelperScrollStyle = record helper for TScrollStyle function ScrollBarStyleName: string; end; { TMyHelperScrollStyle } function TMyHelperScrollStyle.ScrollBarStyleName: string; begin result := GetEnumName(typeinfo(TScrollStyle), ord(Self)); end; procedure TForm1.Button1Click(Sender: TObject); var LStringGridScrollBarsIsUsingThisValues: TMyScrollStylesSetOfValues; begin StringGrid1.ScrollBars := TScrollStyle.ssBoth; // testing... // LStringGridScrollBarsIsUsingThisValues := [ssBoth, ssHorizontal]; // if (StringGrid1.ScrollBars in LStringGridScrollBarsIsUsingThisValues {or ... [ssBoth, ssHorizontal] } ) then Memo1.Lines.Add('1: ' + StringGrid1.ScrollBars.ScrollBarStyleName) else Memo1.Lines.Add('2: ' + StringGrid1.ScrollBars.ScrollBarStyleName); end; -
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
@MikeZ87 I found easy way to changes all "ITEMS" in ComboBox / ListBox using StyleBook setting/object - no needs code anymore! all that you need is open any "style file in your StyleBook", you can find in your Embarcadero Style folders in c:\users\Public folder now, find the object named "listboxitemstyle" and "COPY" this object will have all setting to change your "ITEMS", in ComboBox and/or ListBox together just close all go back to your project/form where is your "StyleBook" component double-click to open it now, just "PASTE" your new object (named "listboxitemstyle") now, do the changes...- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
Delphi 10.2.3 - Stack Overflow Error Opening Any Project
programmerdelphi2k replied to James Steel's topic in Delphi IDE and APIs
@James Steel let's try a new tip... if the bug is cause by a IDE settings, let's try create a new user for this IDE the RAD allow that you use many "user" in your desktop, then just use a command-line to execute this command> ... << your path where is RAD >> \bin\BDS.exe -r newusername <--- "-R" --> newusername = any name never used yet! ex.: c:\rad11\bin\bds.exe -r HelloWorldUser this way, will be create a new "environment" tottally fresh (none components, none addons) like the "first time" ok! in Registry, will be stored a new key em HCU\Software\Embarcadero\... HelloWorldUser key -> you can delete or not if desire use it another times! if ok, then, now you can create a shortcut for use it , else... let's try another tip: all RAD store your settings in c:\users\<<windows user name>>\AppData\Roamming\Embarcadero\BDS\<<nn.nn version>> then, do the backup and delete this folder << nn.nn version >> run you IDE and see if help you if nothing help, then, I think that the way is "re-install it" using a clean-install!!! -
How to see the parameters of the default style?
programmerdelphi2k replied to XylemFlow's topic in FMX
@XylemFlow Here I am RAD 11.3/FMX and using StyleBook 2: 1 StyleBook Default = Empty 1 StyleBook Dark = Win10ModernDark.Style Unfortunately, some components store their properties in Hexadecimal values, so it's not possible to see the values directly, you'll need to convert them. This usually happens for properties with "images", value trees, etc... The "WriteComponent" function is found in TStream subclasses such as TMemoryStream etc... as well as "ReadComponent". Here I will try to demonstrate a way to do it, note that using "MEMO" or any other class that makes use of "TStrings", together with "themes/skins/styles", will be very painful in general, because there is much more involved than just change the skin of the component! NOTE: if you dont need show nothing in "memo", for example, the process is very quickly!!! type TForm1 = class(TForm) mmResourceBin: TMemo; BtnStyleLight: TButton; BtnStyleDark: TButton; stylebookDefault: TStyleBook; stylebookDark: TStyleBook; BtnWriteComponentOnMemo: TButton; BtnHexaToText: TButton; Layout1: TLayout; mmHexaToString: TMemo; mmObjectToText: TMemo; procedure BtnStyleLightClick(Sender: TObject); procedure BtnStyleDarkClick(Sender: TObject); procedure BtnWriteComponentOnMemoClick(Sender: TObject); procedure BtnHexaToTextClick(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} procedure TForm1.BtnStyleLightClick(Sender: TObject); begin mmObjectToText.Lines.Clear; mmResourceBin.Lines.Clear; mmHexaToString.Lines.Clear; // Self.StyleBook := stylebookDefault; end; procedure TForm1.BtnStyleDarkClick(Sender: TObject); begin mmObjectToText.Lines.Clear; mmResourceBin.Lines.Clear; mmHexaToString.Lines.Clear; // Self.StyleBook := stylebookDark; end; procedure TForm1.BtnWriteComponentOnMemoClick(Sender: TObject); var LMemoryStream : TMemoryStream; LStringStream : TStringStream; LText : string; LBeginPosition: integer; // int64... LEndPosition : integer; // "" LOffSet : integer; begin if (Self.StyleBook = nil) then begin mmObjectToText.Text := '"StyleBook = nil"'; // exit; end; // LMemoryStream := TMemoryStream.Create; try LStringStream := TStringStream.Create(LText); try LMemoryStream.WriteComponent(Self.StyleBook); LMemoryStream.Position := 0; // ObjectBinaryToText(LMemoryStream, LStringStream); LStringStream.Position := 0; // // LBeginPosition := -1; LEndPosition := -1; LOffSet := 'ResourcesBin = {'.Length; LBeginPosition := Pos('ResourcesBin = {', LStringStream.DataString); // if (LBeginPosition > 0) then begin LBeginPosition := LBeginPosition + LOffSet + 1; LEndPosition := Pos('}', Copy(LStringStream.DataString, LBeginPosition)) - 1; // if (LEndPosition > LBeginPosition) then begin // trying avoid slow ... mmObjectToText.BeginUpdate; try mmObjectToText.Text := LStringStream.DataString; finally mmObjectToText.EndUpdate; end; // mmResourceBin.BeginUpdate; try mmResourceBin.Text := Copy(LStringStream.DataString, LBeginPosition, LEndPosition).Trim finally mmResourceBin.EndUpdate; end; end else mmResourceBin.Text := '"}" was not found!'; end else mmResourceBin.Text := '"ResourcesBin = {" was not found!'; finally LStringStream.Free; end; finally LMemoryStream.Free; end; end; procedure TForm1.BtnHexaToTextClick(Sender: TObject); var LHexaString: string; LBytes : string; LIndex : integer; LNewText : string; begin LHexaString := mmResourceBin.Text.Replace(slinebreak, '').Replace(' ', ''); LIndex := 0; // if (LHexaString.Length = 0) then begin mmHexaToString.Text := 'mmResourceBin normalized is empty!'; // exit; end; // try for var i: integer := 0 to (LHexaString.Length - 1) div 2 do begin LIndex := (i * 2) + 1; // LBytes := LBytes + ',' + StrToInt('$' + Copy(LHexaString, LIndex, 2)).ToString; end; // for var V in LBytes.Remove(0, 1).Split([',']) do LNewText := LNewText + Chr(StrToInt(V)); // mmHexaToString.BeginUpdate; try mmHexaToString.Text := LNewText; finally mmHexaToString.EndUpdate; end; except on E: Exception do mmHexaToString.Text := E.Message; end; end; -
Delphi 10.2.3 - Stack Overflow Error Opening Any Project
programmerdelphi2k replied to James Steel's topic in Delphi IDE and APIs
@James Steel keep in mind that many "weird" errors as you say, especially when porting old projects to new IDEs, and vice versa, have a lot to do with the project settings files! Thus, whenever porting a project to another IDE, new or old, try to proceed as follows: In the new IDE, create a new project Delete the form that is created automatically, normally "Form1" Now, add all the files (forms, units, etc...) from the old project to this "new" project. Now make the necessary settings in "Project - Options..." and in any other necessary places! Now save this "new" project in a suitable folder for your new IDE. -- use a folder specific for this IDE, ex.: ..\RAD10\prjRAD10 .... ..\RAD11\prjRAD11 .... That's it, if this was the problem, then it won't be anymore! And, finally, you will have a new project preserving the old project, however, using the same files (forms, units, etc...) as you would expect. Now you can make your desired changes, always keeping in mind that, you are developing for two or more IDEs, so use the "compiler directives" when necessary to separate the code pertinent and particular to each IDE involved in your project! -
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
@Ian Branch in fact, you can start one or other, because any one can be server or client, or be, it can receive and send info. you need just create a logical for that, using the events! the server always listen for a client in your network/bluetooth (a TCP/IP server), as you run client first, then you can use a "Timer" (or any strategy) to send a request to connect to the server (be who be) and it's ready. -- dont forget disable it when ok
-
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
Sarina Dupont has a video about Style Designer Bitmap Style Designer with Sarina DuPont - CodeRageXI Ray Konopka Customizing Controls with FMX Styles, with Ray Konopka https://youtu.be/j9XxM7W94p4- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
How can I enlarge the font of a Combobox in Delphi FMX?
programmerdelphi2k replied to MikeZ87's topic in FMX
@MikeZ87 normally, you can do it using "Edit Custom Style" (right button on component), but in ComboBox, in fact, the items is a "ListBoxItems", and there is not a property to change it in StyleBook... that way, you can just right-click on ComboBox, and select each item and change the property on Object Inspector, or by code like this: for var i: integer := 0 to (ComboBox1.Count - 1) do begin ComboBox1.ListItems[i].StyledSettings := []; // remove parent styles... ComboBox1.ListItems[i].Font.Size := 28; // changing the properties... end; exists a "delay" before show new setting...- 13 replies
-
- fmx
- firemonkey
-
(and 5 more)
Tagged with:
-
Error Message after Update to 11.2
programmerdelphi2k replied to schaumermal's topic in General Help
@houssam1984 the Embarcadero create some folders in "C:\Users\<<windows user>>\AppData\Roaming\Embarcadero\BDS\<< version nn.n >>" - this folder is used to initialize some default/changed settings! you can try backup "C:\Users\WIn10H22\AppData\Roaming\Embarcadero" full, and delete it to try a new recreation! (first, close any IDE opened) another way, more easy to test is: you can run the IDE as a new user, like MSWindows user: on CMD (Prompt command line) type: c:\<<dir where your RAD is installed>>\Bin\BDS.exe -r NewUserName <--- any name not used yet! ex. c:\myRADroot\bin\bds.exe -r UserTest <<ENTER>> then, in your Registry "Computer\HKEY_CURRENT_USER\SOFTWARE\Embarcadero\......." will be created a new key with new user settings! a new IDE will be loaded with all default values, including in ...\Roaming\Embarcadero\.... folder after tests, you can simply "delete" the key in your Registry or simple "dont use it anymore" if desire use it, just create a shortcut in your desktop like any other to run your IDE! -
delphi 10.4.2 invalid compiler directive
programmerdelphi2k replied to Manlio Laschena's topic in ICS - Internet Component Suite
-
delphi 10.4.2 invalid compiler directive
programmerdelphi2k replied to Manlio Laschena's topic in ICS - Internet Component Suite
@Manlio Laschena another tip (normally always works) when porting old projects to new IDE, is always good create a new project (DPR at least), then just "ADD" all units/files into it. That way you are certains that all setup would be ok. now, just update any particular setup and save you new Project in a folder to new IDE. Then, you'll have each project to each IDE using same unit files, etc... and, as expected, you'll be able to use "compiler directives" internally in units to ensure that a certain encoding is targeted for each compiler version, for example! little steps, saving many heartbeats! old projects (DPRs/DPROJs) untouched!