in this line
<mx:Label x="132" y="105" id="statusText"/>
I get an error -
Attempting to initialize inherited property 'statusText' of type
'spark.components.supportClasses.TextBase' with value of incompatible
type 'mx.controls.Label'.
Im using flex 4.6
You get this error when you declare something in mxml with id which is already used in the superclass.
Normally it will just use your definition, overriding superclass one if it exists.
But in you code type of your definition for this id and superclass definition for this id are different, so you get this error.
As I see, it was not your intention to override superclass definition, so you shall just rename id for your label.
Related
When trying to access a Firestore database using Kotlin, the error quoted in the title is thrown. The fields of my model class exactly match the Firestore documents I'm trying to access. Why does Android Studio say there is no setter/field?
There is another field in the same class, which apparently works correctly, no error has been thrown. Even their type is the same, both are Boolean. The only difference is in their names, isCreator and admin (the working one).
The problem was with the properties' names. When a property's name starts with "is", one has to explicitly annotate the property's getter the following way:
#get:PropertyName("isCreator")
val isCreator: Boolean
If your property is mutable (aka var), you also have to annotate the setter;
#get:PropertyName("isCreator")
#set:PropertyName("isCreator")
var isCreator: Boolean
Q_PROPERTY(QVariantList sortCriteries WRITE setSortCriteries)
I am getting build warning:
warning : Property declaration sortCriteries has no READ accessor function or associated MEMBER variable. The property will be invalid.
I have tried replacing it with the keyword MEMBER but im getting error that MEMBER keyword is unknown or not recognized
Q_PROPERTY(QVariantList MEMBER sortCriteries WRITE setSortCriteries)
i dont want to make a READ or getter function as it has no use, any idea on how to approach this?
Im using 5.15, any idea?
Your property declaration with MEMBER should look like this:
Q_PROPERTY(QVariantList sortCriteries MEMBER sortCriteriesMember WRITE setSortCriteries)
(Where sortCriteriesMember is obviously the name of the member in your class, which can be different from the property name)
That said, if you only want to be able to write, you can also consider a Q_INVOKABLE:
Q_INVOKABLE void setSortCriteries(const QVariantList& value);
I am using bean validation to validate my entity,
it works fine according to different locales and it shows region-specific error messages, but I want to internationalize a field 'ContactNo' according to the region like my error messages #NotBlank(message="{contactNo.size}").
So how to achieve
#Pattern(regexp="(^$|[0-9]{10})")
private String contactNo;`
where the regexp value changes according to the region?
The the value for the regexp attribute has to be constant i.e. it needs to be available at compile time. So, either it needs to be a string literal as you do now or externalized into a static final variable.
I guess what you need has to be implemented in a custom Bean Validation constraint.
I have the following files:
model.as
clint.mxml
in clint.mxml I have the following line:
<s:Group id='clint1' x="model.locationX">
...
in the model.as I have a getter:
[bindable(event="locationXChanged"))
function get locationX () : int {
return ...
}
My problem is that I need to know within the getter locationX that the id of the object that is getting the id is clint1 (The object id in the mxml).
The result of a getter should not depend on which object it is called from. I guess your getter should not be a getter and should maybe take a clintId as argument.
You can use this to refer to the current component. You can use 'this.id' to find out the component's name. More info on id property.
However, I'm getting mixed signals from your question and the question's title. Are you asking for the id of the binding target inside the binding source? Implementing that would add dependencies to your components thus harming their ability for reuse.
I am writing a small code generator which would read into an edmx file and create business objects on the base of a template. I am using reflection to spit out the type names.
The problem is when I encounter a property (PropertyInfo) of type Entity Reference, (basically an entity property if there is a referential integrity), the PropertyInfo.PropertyType.Name comes as "EntityReference`1" which is not recognized by the compiler.
PropertyInfo.PropertyType.FullName gives "System.Data.Objects.DataClasses.EntityReference`1[[BusinessObjectGenerator.Models.BE_Additional_Info, BusinessObjectGenerator, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]", which is also not recognized by the C# compiler.
Now I faced the same problem with the Nullable types. And I found the static method Nullable.GetUnderlyingType(type) which solved the issue. How do I get the name of type of a property that is an entity type, a name that the C# compiler recognizes?
Generic types contain ` in their Name. To get the C# readable name of the type, you will need to first check if it is a generic type using Type.IsGenericType. If it is a generic type, then you can use Type.GetGenericArguments() to get the list of type arguments to the generic type. By getting their names, you can put together the generic type name like. For example, if the type is
Dictionary<int, string>
Then, the type name would actually be Dictionary`2. Using GetGenericArguments would return an array with two types (int, and string). From these you can generate the composite name.
Note: Each of the types returned from GetGenericArguments() may itself be a generic type, so you should write this as a recursive algorithm.