I'm developing an iOS User Control for Genexus X Ev3, is based on Maps an inherits from GXControlGridBase, the main function is to select a point in the map and return the geolocation updating Genexus attribute and launching an event showing a message with the coordinates stored in the attribute.
Searching I found this:
1- in control definition, .control file defines an event
<Events>
<Event>EventName</Event>
</Events>
2- in Genexus code
Event Control.EventName
...
EndEvent
3- To trigger from Objective-C
[self fireControlEvent:@"EventName" userInterfaceContext:nil withEntityData:nil];
Steps 1&2 are ready (and they work, there is a UC version for Android). In case of Objective-C ¿where I can put that line? ¿how update the genexus attribute value?
Thanks in advance.
To select a point in a map, you can use the SD Geolocation
user control that is built-in in GeneXus.
If you, however, want to make your own user control, you'll probably want to make it a subclass of GXControlEditableWithLabelBase
or GXControlEditableWithLabelSingleEditorViewBase
. That is, given that you want it to have an associated attribute. You say you are using a GXControlGridBase
subclass, that is for lists of values, not just an attribute.
As for the last part of your question, if you need to update the attribute's value, there is no need to trigger an event. You can call this method from the control's implementation:
[self updateEntityDataResolvedFieldWithValue:fieldValue];
The method -updateEntityDataResolvedFieldWithValue:
is defined in the GXControlEditableWithLabelBase
base class.