is scrollbar enabled.

I have a TRichEdit with the ScrollBars property set to ssBoth, but i need a way to check if the scroll bar is enabled.
LVL 2
heretoreadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

wildzeroCommented:
By enabled you mean, is showing up? (ie the user has lots of text in the box?)
0
heretoreadAuthor Commented:
yes, is it currently active.

i need this because if a user resizes the form the richedit is also resized to stay in proportion, but if the scroll bar is active and the form was resized quick, GetScrollPos() will not always return 0.

so my aim is to make a function like

function ScrollPos:Integer;
begin
  if Active then
    //Scrollpos result
  else
    Result:= 0;
end;
0
pcsentinelCommented:
try this

*********************UNIT CODE*********************
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, ComCtrls;

type
  TForm1 = class(TForm)
    RichEdit1: TRichEdit;
    Button1: TButton;
    Label1: TLabel;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var
      lInfo: TScrollBarInfo;
  lh: HWnd;
begin
   FillChar(lInfo, Sizeof(lInfo), 0);
   lInfo.cbSize := Sizeof(lInfo);

      GetScrollBarInfo(richedit1.handle, OBJID_VSCROLL,
        lInfo);

  if ((lInfo.rgstate[0] and STATE_SYSTEM_INVISIBLE) = STATE_SYSTEM_INVISIBLE) then
        label1.caption:='Vert Scroll Bar Not visible'
      else
        label1.caption:='Vert Scroll Bar Visible'

end;

end.

**************FORM CODE**********************
object Form1: TForm1
  Left = 23
  Top = 29
  Width = 307
  Height = 217
  Caption = 'Form1'
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'MS Sans Serif'
  Font.Style = []
  OldCreateOrder = False
  PixelsPerInch = 96
  TextHeight = 13
  object Label1: TLabel
    Left = 132
    Top = 140
    Width = 32
    Height = 13
    Caption = 'Label1'
  end
  object RichEdit1: TRichEdit
    Left = 28
    Top = 32
    Width = 229
    Height = 89
    Lines.Strings = (
      'RichEdit1')
    ScrollBars = ssBoth
    TabOrder = 0
  end
  object Button1: TButton
    Left = 24
    Top = 132
    Width = 75
    Height = 25
    Caption = 'Button1'
    TabOrder = 1
    OnClick = Button1Click
  end
end

*************************************

regards
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
heretoreadAuthor Commented:
Thanks, That was half what i needed, tho i changed STATE_SYSTEM_INVISIBLE to STATE_SYSTEM_UNAVAILABLE.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.