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"

What widget content is selectable, for SListView::OnSelectionChanged?

So, just for testing purposes I have the following widget:

    SAssignNew(SessionList, SListView<FString*>)
 .OnSelectionChanged(this, &SDataVisUI::OnSessionSelectionChanged)
 .ListItemsSource(TestStrings)
 .OnGenerateRow(this, &SDataVisUI::OnGenerateRow)
 .SelectionMode(ESelectionMode::Single)


The actual table row widgets are created using the following:

 SNew(STableRow<FString*>, OwnerTable)
     [
         SNew(STextBlock).Text(*StringPtr)
     ];

(I know that using FString* like this isnt so hot, but bear with me)

However, I can't click on the strings that are displayed in the list in my UI and OnSessionSelectionChanged isn't being called. Is there only a specific sub-set of widgets I can put inside table rows, that will allow me to use this mechanism, or some other flag I have to set on my table rows, or something else at play?

Product Version: Not Selected
Tags:
more ▼

asked Jul 23 '14 at 06:09 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

In theory there should have been a compile error telling you that you cannot use TableViews with non-memory managed pointers. That is, the memory address of your type has to be guaranteed unique. UObject* are garbage collected, so you can use those. You can also use TSharedPtr< FString >/TSharedRef< FString > because they have the necessary property that their memory address is a unique ID. However, with a regular pointer, it is possible to have a pointer, delete it, and then have a new object allocated in the same location. Therefore, regular pointers are not unique and cannot be used by the TableViews.

So you're going to have to do SListView< TSharedRef< FString > > or SListView< TSharedPtr< FString > >. This seems like a pain, but it enabled selection tracking, expansion tracking, and virtualization.

Let me know if you have questions about all this.

EDIT: AnswerHUB is not cooperating with C++ templates. Needs extra space like so: < T >.

more ▼

answered Jul 23 '14 at 06:15 AM

avatar image

Fiskislóð STAFF
441 17 11 132

avatar image twiddle Jul 23 '14 at 06:19 AM

Great, thanks! Will try this out and mark if it sorts the issue.

(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