livecode/livecode-ide

[PI] Setting gradient is quirky

Opened this issue · 14 comments

When setting a gradient the following quirks were observed:

  • It is possible to click on the color setting button without having chosen a gradient to apply even though the option menu indicates Linear (recommend set a gradient if none set yet and include a cancel button on the dialog to back out of changes)
  • It is possible to click on the color setting button without selecting a gradient stop
  • The color dialog is presented behind the gradient dialog (perhaps it can be upgraded to open as sheet?)
  • The color dialog doesn't default to the currently selected color
  • The indicator on the spectrum doesn't match the default color on the color dialog (probably engine or maybe OS X issue but noticed here)
  • When resetting to default the dialog appears in addition to clearing the gradient then choosing Linear from the option button sets a gradient on the object but doesn't indicate the gradient in the dialog.

gradient

Thanks @montegoulding - I think almost all of these are trivial to fix except the color dialog, which is opened with answer color so there aren't any script-level mode options, and the non-matching color thing (there's an outstanding report in BZ for that)

Looks like the color dialog was made non modal here

I remember discussing this with Seb when he was trying to fix various color picker related issues. Cocoa doesn't have a modal color picker and obviously we've not managed to persuade it to be modal :( I believe QT had exactly the same problem at the time... We should see if they have made any progress is solving the issue!

I just had a little play with it and the following will at least ensure it opens above the calling modal at first:

[t_colorPicker setLevel: kCGModalPanelWindowLevel];

We could try kCGPopUpMenuWindowLevel to force the issue...

Yep kCGPopUpMenuWindowLevel does the job nicely

What Seb and I ended up doing was adding a "pseudo-modal" flag and pointer to the engine's NSApplication object that makes the engine pretend that that particular NSWindow is really modal, even when it isn't. It only affects focus and input events - it doesn't force the window to be topmost. It should probably do the relayer at the time of the "beginPseudoModalFor" call (probably not the name of the method, but it is something along those lines) so that it affects all modal dialogs, not just the colour picker.

Ah... yes @livecodefraser becomePseudoModalFor

I'll submit a PR

After #965

  • It is possible to click on the color setting button without having chosen a gradient to apply even though the option menu indicates Linear (recommend set a gradient if none set yet and include a cancel button on the dialog to back out of changes)
  • It is possible to click on the color setting button without selecting a gradient stop
  • The color dialog is presented behind the gradient dialog (perhaps it can be upgraded to open as sheet?)
  • The color dialog doesn't default to the currently selected color
  • The indicator on the spectrum doesn't match the default color on the color dialog (probably engine or maybe OS X issue but noticed here) (http://quality.livecode.com/show_bug.cgi?id=14308)
  • When resetting to default the dialog appears in addition to clearing the gradient then choosing Linear from the option button sets a gradient on the object but doesn't indicate the gradient in the dialog.

@livecodeali I think the indicator on the spectrum issue is a different one. Try answer color "red" and you will get a dialog with likely a target looking control on the spectrum that isn't on red, however, I think this is just standard behavior because that spectrum thing is just an image and you can add other images soo... seems unlikely the color panel will search for the preset color in the image and set the location of the target control. BTW livecode/livecode#3688 deals with the modal behavior of the dialog.

@montegoulding Ah sorry, yes - misunderstood that one. So it may be not fixable then? I actually can't reproduce it here - I get the correct thing here as far as I can see...

Yeah I think it is unfixable or not a bug @livecodeali

Oh, the other thing I was going to suggest was it could select the first stop when the dalog opens which will resolve half of these issues. The biggest issue is probably the first one mentioned though. I think setting an initial gradient if one isn't set and adding a cancel button is the best option.

Oh hang on, my PR does fix that one too (albeit not in the way you have suggested).
We should perhaps mark this as closed and open a new one for default gradient as an enhancement request.