x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How do I bind a slate attribute to a function in an instance of another class?

So my UI widget has a SLATE_ATTRIBUTE for my view model, and I cache that in the Construct() function. Further into Construct() I'm now trying to bind a function from it to the ListItemsSource of a contained widget like so:

 .ListItemsSource(DataView,&DataVisualizationViewModel::GetSessions)

I've verified that GetSessions returns TArray < ListItemType>* as its return type, so that should be fine, but I get the following error:

 'SListView<OptionType>::FArguments::ListItemsSource' : function does not take 2 arguments

I'm presuming that the compiler is having trouble implicitly constructing a TAttribute from my parameters. Is this the case? How should I be binding to functions inside my viewModel?

Product Version: Not Selected
Tags:
more ▼

asked Jul 23 '14 at 08:07 AM in C++ Programming

avatar image

twiddle
1.5k 55 36 73

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Good guess, but it's actually simpler than that:

 SLATE_ARGUMENT( const TArray<ItemType>* , ListItemsSource )

It isn't an ATTRIBUTE. You cannot change it after it is set. Once the ListView is given a TArray pointer to observer, it looks at that pointer until it is destroyed.

more ▼

answered Jul 23 '14 at 08:11 AM

avatar image

Fiskislóð STAFF
441 17 11 132

avatar image Crzyhomer STAFF Jul 23 '14 at 02:53 PM

You can change the source at any time, but you need to call RequestListRefresh when you do. Same goes for any time you update whatever array you've given it. The list view is pretty much a dumb terminal. Anytime you sort/add/remove, you call that function.

avatar image Fiskislóð STAFF Jul 24 '14 at 02:26 AM

Just to clarify. What Josh means is that you can mutate the contents of the array being observed. However, SListView does not provide an API for looking at a different array, which is why the ListItemsSource is an ARGUMENT rather than an ATTRIBUTE.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question