About   |   Getting Started   |   Downloads   |   Documentation   |   Forum


Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
FloatingDialog and ModalDialog = operator differ
05-12-2018, 02:05 PM (This post was last modified: 05-12-2018 02:09 PM by Rick Johnson.)
Post: #1
FloatingDialog and ModalDialog = operator differ
I have two modal dialogs that are almost identical, so I built one in postStartup, then copied it to the second dialog using =, then changed the parts that are different.

Code:
hdi::core::ModalDialog dialog1, dialog2;

// create dialog1 and add widgets

this->dialog2 = this->dialog1;

Works great. I can customize each as needed.

Then I changed them to floating dialogs and the behavior is much different. It seems that any change to one changes the other, like two pointers to the same object. Is this the intended behavior? I know floaters aren't used much, but it does make previews easier than modals without occupying screen space as panels do.

Thanks!
Find all posts by this user
Quote this message in a reply
05-31-2018, 01:54 PM
Post: #2
RE: FloatingDialog and ModalDialog = operator differ
This is an artifact of how modal dialogs and floating dialogs differ under the hood, so it's sort of a gray-area bug.

The underlying floating dialog is created once, along with all of its widgets. This is because the floating dialog can be shown/hidden at any time, and it does not block. So assigning one FD to another FD simply results in you referencing the same underlying platform-based dialog in both cases. (i.e. assigning is basically referencing what's already there)

With modal dialogs, the underlying platform-based dialog is created only at the time it is shown and destroyed immediately after it is dismissed. So, assigning one MD to another MD results in what looks like two distinct dialogs, but really it's just that both are only created and destroyed when needed. (i.e. assigning has nothing to reference at assignment time, as every physical widget is created later)
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)