Recent

Author Topic: FlatSB_GetScrollInfo error  (Read 630 times)

gege

  • New member
  • *
  • Posts: 8
FlatSB_GetScrollInfo error
« on: November 06, 2022, 10:41:46 am »
hello,
I can't figure out the "FlatSB_GetScrollInfo -> Got "tagScrollInfo" expected "SCROLLINFO" error.
Here is my code:
   var
     GfSi: TScrollInfo;
     Code: Integer;

   begin
     GfSi.cbSize := SizeOf(TScrollInfo);
     GfSi.fMask := SIF_TRACKPOS;
     Code:= SB_HORZ;
     if fKind = sbVertical then Code:= SB_VERT;
     Result := Msg.Pos;
     if FlatSB_GetScrollInfo(Owner.Handle, Code, GfSi) then
       Result := GfSi.nTrackPos;
   end;
Does it work with delphi?
Thank you for your answers.

jamie

  • Hero Member
  • *****
  • Posts: 6134
Re: FlatSB_GetScrollInfo error
« Reply #1 on: November 06, 2022, 11:20:29 am »
Remove the T at the var section of tscrollinfo? You are not using the correct one.
You may also need to include the windows unit.
The only true wisdom is knowing you know nothing

gege

  • New member
  • *
  • Posts: 8
Re: FlatSB_GetScrollInfo error
« Reply #2 on: November 06, 2022, 12:44:48 pm »
Thank you for your answer, the windows unit is already declared. I was inspired by TurboPowerIPro by adding:
    FlatSB_GetScrollInfo: function(hWnd: HWND; BarFlag: Integer;
                                   var ScrollInfo: TScrollInfo): BOOL; stdcall;
    FlatSB_GetScrollPos: function(hWnd: HWND; nBar: Integer): Integer; stdcall;
    FlatSB_SetScrollPos: function(hWnd: HWND; nBar, nPos: Integer;
                                  bRedraw: BOOL): Integer; stdcall;
    FlatSB_SetScrollProp: function(p1: HWND; index: Integer; newValue: Integer;
                                   p4: Bool): Bool; stdcall;
    FlatSB_SetScrollInfo: function(hWnd: HWND; BarFlag: Integer;
                                   const ScrollInfo: TScrollInfo; Redraw: BOOL): Integer; stdcall;

This solves the problem.
I try to adapt SimpleGraph to lazarus, didn't finish.
Sincerely.
Gege

wp

  • Hero Member
  • *****
  • Posts: 11923
Re: FlatSB_GetScrollInfo error
« Reply #3 on: November 06, 2022, 03:01:00 pm »
The way I understand the IPro functions it seems that they simply do nothing else than call the standard GetScrollInfo etc (without "FlatSB_..."), and they have been made cross-platform in the LCLIntf unit. So, your original code should work too when you remove the "FlatSB_" prefix from the function names. And you might be able to avoid the Windows unit which is the main obstacle in making libraries cross-platform.

jamie

  • Hero Member
  • *****
  • Posts: 6134
Re: FlatSB_GetScrollInfo error
« Reply #4 on: November 06, 2022, 03:43:09 pm »
  That API call seems to be supported starting with Vista, and it appears to use the same record structures as the basic one.
 
  Maybe it would be prudent to place a check point up in the Win32 libs to investigate the existence of this API and load it dynamically and use that one instead of the standard, since MS claims it uses the standard anyways if the window has not been set for flat bars.

  This way apps can still run-on older systems which I really would appreciate, and I don't think I stand alone here.
The only true wisdom is knowing you know nothing

gege

  • New member
  • *
  • Posts: 8
Re: FlatSB_GetScrollInfo error
« Reply #5 on: December 10, 2022, 11:25:14 am »
Merci de vos réponses

 

TinyPortal © 2005-2018