[Lazarus] TStringGrid and cancelling a modal form
zeljko at holobit.net
Mon Mar 12 18:37:49 CET 2018
On 03/12/2018 06:25 PM, Mark Morgan Lloyd via Lazarus wrote:
> Running on (Debian) Linux on AMD64 or ARM, Lazarus 1.6.4 and FPC 3.0.2,
> I'm seeing different behaviour depending on whether a program uses Qt or
> GTK2. The program changes the hardware configuration of a mouse
> (Logitech G600) using hidraw, and as such needs to run with root
> privilege (e.g. kdesudo or sudo -E).
> On the main form I've got (a tabbed notebook containing multiple
> instances of) a TStringGrid. The OnSelection event invokes a modal form
> (containing nothing of significant complexity) with OK and Cancel
> buttons, and stripped down looks like this:
> procedure TFormLG600.StringGridMode1UnshiftedSelection(Sender: TObject;
> aCol, aRow: Integer);
> if ButtonsAndKeys.ShowModal() = mrOk then begin
> This is fine if built for Qt, but if built for GTK2 what I see is that
> after the modal form is exited any mouse activity over the grid appears
> to cause an erratic multicell selection and the modal form immediately
> pops up again. This is reproducible if the Cancel button is pressed, and
> in at least some cases after OK.
> I've seen indeterminate discussion of this in the foramina, and have
> followed up the indicated wiki pages etc. Does anybody have any
> suggestions, preferably not along the lines of "don't use GTK2" since I
> was thinking of sticking this on Sourceforge and that restriction would
> probably be unpopular?
hmm, try LCLIntf.SetCapture(0) after closing modal form , just to
isolate capture problems.
More information about the Lazarus