-
Content Count
98 -
Joined
-
Last visited
Everything posted by bravesofts
-
Getting an Object Instance Name when ancestor is of TComponent
bravesofts posted a topic in Algorithms, Data Structures and Class Design
i have this Abstract Base Unit : unit UBase; interface uses System.Classes; type TBaseAbstract = class(TComponent) procedure Method(aObjectEvent: TNotifyEvent); virtual; abstract; end; TConcrete = class(TBaseAbstract) procedure Method(aObjectEvent: TNotifyEvent); override; strict private fReadOnlyProperty: string; public constructor New(aValue: string; aOwner: TComponent); destructor Destroy; override; property ReadOnlyProperty: string Read fReadOnlyProperty; // Read Only Property .. end; implementation { TConcrete } destructor TConcrete.Destroy; begin inherited; end; procedure TConcrete.Method(aObjectEvent: TNotifyEvent); begin aObjectEvent(Self) end; constructor TConcrete.New(aValue: string; aOwner: TComponent); begin inherited Create(aOwner); fReadOnlyProperty := aValue + Self.ClassName +' ] '+ sLineBreak + 'Object Instance Name is: [' + Self.Name +' ]'; end; end. in my App Demo Main Form i have this: var FrmMain: TFrmMain; implementation uses UBase; var fConcrete: TConcrete; fBASE: TBaseAbstract; {$R *.dfm} procedure TFrmMain.FormCreate(Sender: TObject); begin fConcrete := TConcrete.New('i''m a Read Only PROPERTY of [ ', Self); end; procedure TFrmMain.FormDestroy(Sender: TObject); begin fConcrete.Free; end; procedure TFrmMain.Btn_Normal_EventClick(Sender: TObject); begin ShowMessage('i''m an Event of [ ' + Sender.ClassName +' ] '+ sLineBreak + ' And My Object Instance Name IS: [ ' + TComponent(Sender).Name +' ]'); end; procedure TFrmMain.Btn_Call_MethodClick(Sender: TObject); begin fBASE := TConcrete.Create(nil); try fBASE.Method(Btn_Normal_Event.OnClick); finally fBASE.Free; end; end; procedure TFrmMain.Btn_Call_Abstract_MethodClick(Sender: TObject); begin fConcrete.Method(Btn_Normal_Event.OnClick); end; procedure TFrmMain.Btn_Get_Concret_PropertyClick(Sender: TObject); begin ShowMessage(fConcrete.ReadOnlyProperty); end; end. Btn_Normal_EventClick work correctlly (i got the name of this button when i click on it [Btn_Normal_Event]) but from fConcrete or fBase whether using Abstract Method or GetProperty the NAME IS EMPTY !!! ------------ do i missing something ? -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
a Nice Blog from Marco here -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
wow it seems a complicated backstage that the developer like me didn't know or even think about it previously !!! ------- i need to a respect time to understand exactly what happen inside that designtime backstage !!! thank you All for this Very valuable information ... -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
i have another Kinda strange question: (Maybe a Stupid hhh :) ) why the components that we create at designtime can call them using their NAME's Rather Call them from their Variables Names that Contains them ? in runtime we can do this for ex: procedure CreateButton(aParent: TWinControl; aBtnEvent: TNotifyEvent); var vButton: TButton; begin vButton := TButton.Create(Self); try vButton.Parent := aParent; vButton.Name := 'Btn_Test'; vButton.SetBounds(10, 10, 100, 25); vButton.Caption := 'Test'; vButton.OnClick := aBtnEvent; finally vButton.Visible := True; end; end; whereas any Object created at designtime we call them using their Name !!! -------- what is the secret thing or the missing part that should i know (seriously) to understand the difference between an Object Name at DesignTime & Obj Name RunTime ? -------- i know Logically that we can't Call any Obj not yet created in designtime from his NAME because it is not reconized for our Project yet (Therefore, we used variables instead), whereas we can call Objects that was created at designTime just from their Names because our Project know them & Recognize them !!(so how did recognize them and use TComponentName which is a string by default as pointer or i don't know as whatever is !!!) ------- what i mean exactlly: what happen to any OBJ CREATED AT DESIGNTIME makes delphi & our project call them from thier Names instead of variables Names like the RunTime Scenario does ?? -------- i know that my question is trivial & stupid !!! but (seriously) i'm lost here (i know that i missing An essential thing that childrens know ....) plz clarify to me the Secret behind delphi backstage designtime objects !!! Notice: All Objects will at the end created Atruntime (so why designtime is a superbox than others !!! (is a designtime = a temporary or pre runtime section or what is the word that can describe this superbox better than designtime ???) ) -------- in another meaning: why TComponentName of any OBJECT from ObjectInspector IS totally different from TComponentName of Runtime of any Object !!! they are both a string (TComponentName = type string;) from System.Classes -------- thanks in advance -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
thank you All for All this Infos ... ----- Really i'm not just low on caffeine :) i Missing one of the Pillar of delphi language hhh -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
is it fBase the name of that Object fBase ? and fConcrete the name of fConcrete Object -------- for example the NORMAL Button when user click on it it will give him the TButton as ClassName and the Btn_Normal_Event as Object Name where the Default was Button1 in Delphi -
Getting an Object Instance Name when ancestor is of TComponent
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
i test also the code for a Normal Class with ancestor TComponent the same Result !!! ------ why ? -
why shortstring in Delphi cannot used in our Programs using New IDE?
bravesofts posted a topic in Algorithms, Data Structures and Class Design
i read carefully this Emb docwiki page here And this sentence caught my eye: Note: ShortString is used by the Delphi desktop compilers, but is not supported by the Delphi mobile compilers. For more information, see Migrating Delphi Code to Mobile from Desktop. does this mean a desktop program is compatible to work with this shortstring without any future problems while in mobile can't ...? or shortstring is not compatible for any platform (is just maintained for backward compatibility only. like coding a library for example ...) ----- Also : if my first understanding is true, why there is no shortstring in mobile platforms (I think the mobile platforms is the first and most deserving of this Short TYPE HAhA HAhA HAhA ) Also: why Shortstring is Old and eliminated or Died while Byte Still Alive... ------------- Note: My question is Related with this Question here. -
try to add TScrollbar and make it related with that SynEdit and finally you will have a completely separated scrollbar with StyleElement property don't forget to make Scrollbars property to ssNone for your SynEdit
-
delphi set max length for Argument of string in a method
bravesofts posted a topic in Algorithms, Data Structures and Class Design
is there a possible way to SetLength using [Max Length] for arg of string in a Method ? function foo(aValue: string [20]): Result; procedure foo(aValue: string [20]); this question is just a Curious question and nothing more .. -
why shortstring in Delphi cannot used in our Programs using New IDE?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
Thank you so much ... -
delphi set max length for Argument of string in a method
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
It seems to me that this technique is not implemented yet !! (not only delphi maybe all languages) --------- and thank you All for the Advice about the shortstring ... -
delphi set max length for Argument of string in a method
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
the valid code that can fit to my question is this: type TTwenty: string [20]; function foo(aValue: TTwenty): Result; procedure foo(aValue: TTwenty); i hope my question is clear now ----------- is ther a way to avoid declaring a new custom types for every arg ? ----------- Note: My question is Always a Curious question .. -
is it possible to create an Enumeration Type at runtime ?
bravesofts posted a topic in Algorithms, Data Structures and Class Design
is it possible to create an Enumeration Type at runtime ? -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
while EnumTypes was just a const list of predefined values ... i think it is impossible or a kind of crazy to make a dynamic declaration for it !!!! same thing with any const value that we use in our Apps ... -------- my conclusion: An Enumeration Type is just a predefined const list of values ------- Answer is no way logically and not unfortunatelly -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
let think that delphi has just Enum Types for just a second and think about my Random Scenario Above is impose us to use just the Enum Type !!!! ---------- i know that scenario it wasn't able to convincing you to use the Enum Type (and me too) but i want to know just if delphi has dynamic (Enum Types ) -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
let says that my scenario is about gathering a range of colors and my user types 3 or 5 colors ( note: the popup box allow user adding whatever colors he want without knowing the limit count until the popup box closed by the user) ofcourse we can configure this popupbox with a Max Values.... ----------------- what i need to know is how could you know the count of colors that the user entered and put it in a predefined field or a property !!!! -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
yeah i understand the dificulties about this question, (and about my example above about names it was just a random scenario that doesn't matter to me !!) what i care is to talk about my goal subject(Enum Types) and Possible real scenarios will impose the use of a Dynamic Enumeration types ... ===== thanks Mr Fr0sT.Brutal for your Logic Reply.. -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
could you clarify your reply with a simple and easy example plz? -
is it possible to create an Enumeration Type at runtime ?
bravesofts replied to bravesofts's topic in Algorithms, Data Structures and Class Design
for ex: in delphi we can put a button and when user click on it a dialog box popup ask him to type names i ask if there is a possible way that can let me create an Enumeration type dynamically ? ===== in another meaning : Is Enumeration type can be declared at runtime depending of any input situations (just after knowing fields then declare it dynamically and use it after that like any normal Enum and All that at RunTim) ? -
Enumeration Type as Parameter
bravesofts replied to chkaufmann's topic in RTL and Delphi Object Pascal
why you Use the Word "Set" Instead of "Enum" or "whatever words except Set" is it possible to call an "Enumeration Type" as a "Set Type" ? TSetValues = (svOne, svTwo, svThree, svFour, svFive); the Right declaration must be any name except this : TSetValues TEnumValues = (evOne, evTwo, evThree, evFour, evFive); Sets are declared like that: TSet_Of_Digits = set of '1'..'9'; i hope i'm not wrong !!! -
just run it from your DELPHI iDE AFTER ADDING LIBRARY PATH ..\jcl\lib\d27\win32 ..\jcl\source\include ..\jvcl\lib\d27\win32 ..\jvcl\common ..\jvcl\resources Remark: please use download link from repo using Github desktop i hope this steps will be helfull for
-
hello All: . May i know please the right way to work with custom fonts inside android.?i have Patch this unit here: (FMX.FontGlyphs.Android), but no effect....i know that Alcinoe controls are native device controls and the paint in fmx android is ( FPaint: JPaint; )please guide me and if there is any demo or sample will be more helpful..i have watch in youtube how can do that in android studio and i follow the same steps but the controls didn't change their font as i expected ...i deploy a folder inside the res remote path named as (font) an inside that folder i deploy two xml files( attr.xml and myfont_familly.xml) and also deploy my fonts there ..after that i go to my custom styles.xml and i add this line here:<item name="android:fontFamily">@font/myfont_familly</item>but when i compile to run in android no effect happen ???please any reply will be so usefull SMS Read-Write.rar