Exo_Guid
9 months agoPartner
UI Button with sendCodeblockEvent
Hello!
I'm editing a script in which my UI buttons should send an event with parameter to a target object containing a codeblock script. Everything is setup and will print to the debug log but I'm having an issue constructing the send event code:
type GenericDialogProps = {}
function pickoption0(this: any): void {
console.log("option1");
this.sendCodeBlockEvent(this.props.target, new CodeBlockEvent<[index: number]>('GetOption',[PropTypes.Number]), "0")
}
function pickoption1(): void {
console.log("option1");
}
function pickoption2(): void {
console.log("option2");
}
function pickoption3(): void {
console.log("option3");
}
function pickoption4(): void {
console.log("option4");
}
class UItemplate extends UIComponent<GenericDialogProps> {
static propsDefinition = {
target: {type: PropTypes.Entity},
index: {type: PropTypes.Number},
I receive the error:
Error Handling Event:
TypeError: Cannot read properties of undefined (reading 'sendCodeBlockEvent')
at pickoption0 (UItemplate.ts:152:7)
at option0 (UItemplate.ts:183:12)
at horizon/ui/HorizonUI.ts:1875:12