Thanks for the input. The property UpdatingControl
never changes.
I've been poking further and found that the
self.layerticklist1.Content
is a System.Windows.Controls.ListBox. I found that it has an object "System.Windows.Controls.ItemContainerGenerator" which provides an event "StatusChanged".
Waiting for it and checking its status I can now set the checkboxes once the itemlist is repopulated.
self.layerticklist1.Content.ItemContainerGenerator.StatusChanged += self.layer1populated
def layer1populated(self, sender, e):
# generator status - 0-not started; 1-generating; 2-generated/done; 3-error
if int(sender.Status) == 2:
self.layerticklist1.SelectedSerialsX = selectedserials
------------------------------
Ronny Schneider
------------------------------
Original Message:
Sent: 11-22-2024 16:23
From: Bryce Haire
Subject: is there a specific event that signals if the content of Trimble.Vce.UI.Controls.Wpf.CheckedListBoxEntityPicker is fully updated - how to wait for it
Hi Ronny,
We tried taking a look and not sure totally sure of what is happening on what you are seeing. The thought was `SetExcludedEntities` is run on the main UI thread, and the method would have returned when the UI is set/processed. Based on your description, that may not be the case in your situation it appears.
One potential solution is looking at the property UpdatingControl
on the CheckedListBoxEntityPickerController
and seeing if it goes from false
-> true
-> false
.
Unfortunately, there is no event emitted, so you would probably need to setup a poller between the SetExcludedEntities
and the reset of that value to false
. Maybe the first step is logging the value of this and seeing if it changes during your testing and/or if it is the trigger for what you need.
Hope this helps some.
------------------------------
Bryce Haire
Original Message:
Sent: 11-21-2024 03:24
From: Ronny Schneider
Subject: is there a specific event that signals if the content of Trimble.Vce.UI.Controls.Wpf.CheckedListBoxEntityPicker is fully updated - how to wait for it
I'm having troubles to update the state of checkboxes in a Wpf.CheckedListBoxEntityPicker right after setting excludes.
I'm applying a List with serials to filter what is shown in the list.
self.layerticklist1.SearchContainer = Project.FixedSerial.LayerContainerself.layerticklist1.UseSelectionEngine = Falseself.layerticklist1.SetEntityType(clr.GetClrType(Layer), self.currentProject)self.layerticklist1.SetExcludedEntities(exclude)
That triggers a rebuilt of the CheckedListBoxEntityPicker.Content.Items.
Until that rebuild is finished I can't set the state of the checkboxes. I've tried waiting. But it doesn't seem to be possible during the current runtime of the macro.
During the next execution
self.layerticklist1.SelectedSerialsX
does have the desired effect.
What would signal that the Wpf.CheckedListBoxEntityPicker is finished with all background updates and is ready for new tasks.
------------------------------
Ronny Schneider
------------------------------