View Issue Details

IDProjectCategoryView StatusLast Update
0037351LazarusWidgetsetpublic2020-11-01 11:54
ReporterJuha Manninen Assigned ToJuha Manninen  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN) 
Summary0037351: [GTK3] Hint window does not work
DescriptionWhen a control has Hint text and ShowHint = True, at runtime the hint shows only at the first time. When mouse cursor moves away from the control and then back, there is no hint.
Steps To ReproducePlace a TButton on a form. In OI type "My Hint Text" to its Hint property and set ShowHint = True.
Run the application and move mouse over the button.
Additional Informationr63559 improved the situation. Before that any hint window caused a crash.
TagsNo tags attached.
Fixed in Revisionr64067
LazTarget-
WidgetsetGTK 3
Attached Files

Relationships

related to 0037712 new gtk3: TApplication.ActivateHint refreshes hint on every mouse move 

Activities

Anton Kavalenka

2020-10-24 10:43

reporter   ~0126503

Redesign TGtk3HintWindow. Get rid of scrolling support as it prevents proper resize of hint window.
gtk3hintwin.diff (3,019 bytes)   
Index: lcl/interfaces/gtk3/gtk3widgets.pas
===================================================================
--- lcl/interfaces/gtk3/gtk3widgets.pas	(revision 64061)
+++ lcl/interfaces/gtk3/gtk3widgets.pas	(working copy)
@@ -7262,47 +7262,21 @@
   FHasPaint := True;
   AForm := THintWindow(LCLObject);
 
-  FWidgetType := [wtWidget, wtContainer, wtScrollingWin, wtWindow, wtHintWindow];
+  FWidgetType := [wtWidget, wtContainer, wtWindow, wtHintWindow];
 
   Result := TGtkWindow.new(GTK_WINDOW_POPUP);
 
   FBox := TGtkVBox.new(GTK_ORIENTATION_VERTICAL, 0);
+  PGtkContainer(Result)^.add(FBox);
 
-  if (AForm.Menu <> nil) then
-  begin
-    FMenuBar := TGtkMenuBar.new; // our menubar (needed for main menu)
-    // MenuBar
-    //  -> Menu    Menu2
-    //    Item 1   Item 3
-    //    Item 2
-    g_object_set_data(Result,'lclmenubar',GPointer(1));
-    FBox^.pack_start(FMenuBar, False, False, 0);
-  end;
+  FCentralWidget := TGtkFixed.new;
 
-  FScrollWin := PGtkScrolledWindow(TGtkScrolledWindow.new(nil, nil));
-  g_object_set_data(FScrollWin,'lclscrollingwindow',GPointer(1));
-  g_object_set_data(PGObject(FScrollWin), 'lclwidget', Self);
+  FCentralWidget^.set_size_request(AForm.Width,AForm.Height+1);
 
+  fBox^.pack_start(fCentralWidget, true, true, 0);
 
-  //FCentralWidget := TGtkLayout.new(nil, nil);
-  FCentralWidget := TGtkFixed.new;
-  FCentralWidget^.set_has_window(True);
-  FCentralWidget^.show;
+  PGtkWindow(Result)^.set_can_focus(false);
 
-  FScrollWin^.add_with_viewport(FCentralWidget);
-  // FScrollWin^.add(FCentralWidget);
-  FScrollWin^.show;
-  FBox^.pack_end(FScrollWin, True, True, 0);
-  FBox^.show;
-
-  FScrollWin^.get_vscrollbar^.set_can_focus(False);
-  FScrollWin^.get_hscrollbar^.set_can_focus(False);
-  FScrollWin^.set_policy(GTK_POLICY_NEVER, GTK_POLICY_NEVER);
-  PGtkContainer(Result)^.add(FBox);
-  // FWidgetType := FWidgetType + [wtContainer, wtWindow];
-  // Result := TGtkWindow.new(GTK_WINDOW_POPUP);
-  // FCentralWidget := TGtkFixed.new;
-  // PGtkWindow(Result)^.add(FCentralWidget);
 end;
 
 { TGtk3Dialog }
Index: lcl/interfaces/gtk3/gtk3wsforms.pp
===================================================================
--- lcl/interfaces/gtk3/gtk3wsforms.pp	(revision 64061)
+++ lcl/interfaces/gtk3/gtk3wsforms.pp	(working copy)
@@ -219,7 +219,7 @@
     PGtkWindow(AWidget)^.get_preferred_height(@AMinSize, @ANaturalSize);
 
     AWidget^.size_allocate(@ARect);
-    if not (csDesigning in AForm.ComponentState) and (AForm.Parent = nil) and (AForm.ParentWindow = 0) then
+    if not (csDesigning in AForm.ComponentState) {and (AForm.Parent = nil) and (AForm.ParentWindow = 0)} then
     begin
       AFixedWidthHeight := AForm.BorderStyle in [bsDialog, bsSingle, bsToolWindow];
       with Geometry do
@@ -269,6 +269,7 @@
     end;
     PGtkWindow(AWidget)^.resize(AWidth, AHeight);
     PGtkWindow(AWidget)^.move(ALeft, ATop);
+    PGtkWindow(AWidget)^.set_size_request(AWidth,AHeight);
   finally
     TGtk3Widget(AWinControl.Handle).EndUpdate;
   end;
gtk3hintwin.diff (3,019 bytes)   

Anton Kavalenka

2020-10-24 12:17

reporter   ~0126506

test app uploaded
tst-opendlg.zip (3,474 bytes)

Juha Manninen

2020-10-24 14:30

developer   ~0126509

Applied, thanks.
Amazing, it works better even though the amount of code decreased. :)

Issue History

Date Modified Username Field Change
2020-07-14 21:23 Juha Manninen New Issue
2020-09-07 08:55 Juha Manninen Relationship added related to 0037712
2020-10-24 10:43 Anton Kavalenka Note Added: 0126503
2020-10-24 10:43 Anton Kavalenka File Added: gtk3hintwin.diff
2020-10-24 12:17 Anton Kavalenka Note Added: 0126506
2020-10-24 12:17 Anton Kavalenka File Added: tst-opendlg.zip
2020-10-24 14:29 Juha Manninen Assigned To => Juha Manninen
2020-10-24 14:29 Juha Manninen Status new => assigned
2020-10-24 14:30 Juha Manninen Status assigned => resolved
2020-10-24 14:30 Juha Manninen Resolution open => fixed
2020-10-24 14:30 Juha Manninen Fixed in Revision => r64067
2020-10-24 14:30 Juha Manninen LazTarget => -
2020-10-24 14:30 Juha Manninen Widgetset GTK 3 => GTK 3
2020-10-24 14:30 Juha Manninen Note Added: 0126509
2020-11-01 11:54 Juha Manninen Status resolved => closed