-
Content Count
37 -
Joined
-
Last visited
Posts posted by bravesofts
-
-
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 ..
-
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
-
7 minutes ago, Fr0sT.Brutal said:Why do you think you need dynamic enum here? The task looks like "get a user-picked set of items from colors enum". Of course there could be not more than 256 elements in enum so if you allow custom colors you'd have to use arrays/lists of integers.
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 )
-
1 minute ago, Kas Ob. said:Well there is no specific example, it is OP in abstract, its essence.
you "can put a button and when user click on it a dialog box popup ask him to type names", then take that name and associated it with a class that is inherited from your type, put it in a field or a property and you have your runtime type, runtime type that is configured by your user.
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 !!!!
-
10 minutes ago, Fr0sT.Brutal said:I don't think so. Probably with dirty hacks only (like modifying TypeInfo of a previously declared type).
But if you just want to use custom names, you don't need to declare a new type for this
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..
-
15 minutes ago, Kas Ob. said:Yes, it is possible ! 😎
And they are called Object (or Class) descendants.
could you clarify your reply with a simple and easy example plz?
-
for ex:
in delphi we can put a button and when user click on it a dialog box popup ask him to type namesi 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) ? -
is it possible to create an Enumeration Type at runtime ?
-
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 !!!
-
-
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
delphi set max length for Argument of string in a method
in Algorithms, Data Structures and Class Design
Posted · Edited by bravesofts
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 ..