Hi,
I would like to find CMlControl in CMlPage by Ident... is it posssible a fast way ?
is there a way to point CMlControl by Ident on a CMlPage ?
Moderator: English Moderator
Re: is there a way to point CMlControl by Ident on a CMlPage ?
I think using Classes as indexes doesn't work out good...
declare Integer[CMlLabel] for Page = Integer[CMlLabel];
So best way to fix this would be to point control by ident
declare Integer[CMlLabel] for Page = Integer[CMlLabel];
Code: Select all
Void TriggerConfirmButtonClick(CMlLabel Control) {
log(Control); // Control = CMlLabel#1234
if (Control.Parent.HasClass("uiButton")) {
if (pendingConfirmIds.existskey(Control.Id) == False) {
pendingConfirmIds[Control.Id] = Control.Value;
pendingConfirms[Control] = Now; // Control = CMlLabel#Null
}
}
....
Re: is there a way to point CMlControl by Ident on a CMlPage ?
ok Answering myself, fixed by adding
It kinda looks stupid on code side when there's 3 variables doing "same" thingy... but it works.
Code: Select all
declare CMlLabel[Ident] pendingConfirmControls for Page = CMlLabel[Ident];
pendingConfirmControls[Control.Id] = Control;
Re: is there a way to point CMlControl by Ident on a CMlPage ?
(You are not trying to use classes as index values but objects (= instances of classes).)
Using objects as index values should work (as the array-key hashing probably already works on the idents).
I can't reconstruct and don't understand your problem from what you are providing.
As you probably are only concerned for a certain set of controls to find by ident (say elements with a certain class), you could initially build yourself a map with ident=>control. Keep in mind that you would probably want each element from your GetClassChildren_Result in a temporary variable to not accidently lose track of it along the way.
From the snippets you provided I don't see why you would need so many arrays. If you keep track of the controls themselves, you don't need to store e.g. the Label's text alongside as you can access it from the control anyway. In the same way you can declare additional variables like this Now-value for the control.
Using objects as index values should work (as the array-key hashing probably already works on the idents).
I can't reconstruct and don't understand your problem from what you are providing.
As you probably are only concerned for a certain set of controls to find by ident (say elements with a certain class), you could initially build yourself a map with ident=>control. Keep in mind that you would probably want each element from your GetClassChildren_Result in a temporary variable to not accidently lose track of it along the way.
From the snippets you provided I don't see why you would need so many arrays. If you keep track of the controls themselves, you don't need to store e.g. the Label's text alongside as you can access it from the control anyway. In the same way you can declare additional variables like this Now-value for the control.
Who is online
Users browsing this forum: No registered users and 3 guests