- This topic has 3 replies, 3 voices, and was last updated 2 years, 10 months ago by
m.rabatscher.
Viewing 3 posts - 1 through 3 (of 3 total)
-
AuthorPosts
-
June 11, 2022 at 3:51 am #70915June 13, 2022 at 9:03 am #70918
ralfiii
ParticipantCool, thanks!
I found TsTitleBar is also an option to place a Plogressbar up there:procedure TfrmDarwin.sDarwinTitleBarItems1DrawItem(Item: TacTitleBarItem; ADrawData: TacTitleItemDrawData); const cTopOffset = 2; begin if geProgress.Progress > 0 then begin ADrawData.Bmp.Canvas.Lock; OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, aDrawData.ARect.Left, aDrawData.ARect.Top + cTopOffset, nil ); geProgress.Perform(WM_PAINT, WPARAM(ADrawData.Bmp.Canvas.Handle), 0); OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, -aDrawData.ARect.Left, -aDrawData.ARect.Top - cTopOffset, nil ); ADrawData.Bmp.Canvas.Unlock; end; end;
-
This reply was modified 2 years, 10 months ago by
ralfiii.
July 6, 2022 at 8:21 am #70930m.rabatscher
Participant@ alpha skin team:
this option above works fine BUT! :In some circumstances the code above leads to a stack overflow
-> if some caches are not ready yet the WM_PAINT call triggers a full repaint?!?! which again triggres
this event handler to be called again.So basically the code needs to be modified as:
procedure TfrmDarwin.sDarwinTitleBarItems1DrawItem(Item: TacTitleBarItem; ADrawData: TacTitleItemDrawData); const cTopOffset = 2; begin if not fInTitleDrawing and (geProgress.Progress > 0) then begin // ########################################### // #### Now paint the hidden progress bar to the titel bar // the Perform(WM_PAINT,...) method can atually cause a stack overflow in case the timing is bad and the components cache has not yet been // created before the title bar is drawn. This should not happen though in the component and is just a hack to avoid the stack problem. // basically start the darwin with bad sema connection params and see the overflow happen fInTitleDrawing := True; try ADrawData.Bmp.Canvas.Lock; OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, aDrawData.ARect.Left, aDrawData.ARect.Top + cTopOffset, nil ); geProgress.Perform(WM_PAINT, WPARAM(ADrawData.Bmp.Canvas.Handle), 0); OffsetViewportOrgEx(ADrawData.Bmp.Canvas.Handle, -aDrawData.ARect.Left, -aDrawData.ARect.Top - cTopOffset, nil ); ADrawData.Bmp.Canvas.Unlock; finally fInTitleDrawing := False; end; end; end;
Note:
fInTitleDrawing
is a member variable of the form-
This reply was modified 2 years, 10 months ago by
m.rabatscher.
-
This reply was modified 2 years, 10 months ago by
-
AuthorPosts
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.