ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
Forum membership is Free!  Click Join to sign-up
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 Scrollbar problem in TImageEnMView
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

982 Posts

Posted - Oct 29 2017 :  08:36:21  Show Profile  Reply
I have set the width of my (one-column) TImageEnMView to fit its content:



But when it has a scrollbar (due to diminished height) then the scrollbar reduces its client width:



Isn't there a setting to keep the client width when TImageEnMView has a scrollbar? I.e., the scrollbar should not take space from the client width but rather automatically enlarge the control's width.

This would be very useful. If there is no such option then please implement it.

w2m

USA
1990 Posts

Posted - Oct 29 2017 :  09:12:08  Show Profile  Reply
There is no option to do this as far as I know. I just adjust the width to be wider to so that the text is not cut off. When you do this however there is extra space until the scrollbar appears.

Bill Miller
Adirondack Software & Graphics
Email: w2m@hughes.net
EBook: http://www.imageen.com/ebook/
Custom Commercial ImageEn Development
Go to Top of Page

xequte

39053 Posts

Posted - Oct 29 2017 :  15:06:12  Show Profile  Reply
Hi


You can use the OnImageAdded event:

https://www.imageen.com/help/TImageEnMView.OnImageAdded.html


To check whether there are scollbars visible:

https://www.imageen.com/help/TImageEnMView.CurrentScrollBars.html


And set the width to include or exclude the scollbar width using these two values:

https://www.imageen.com/help/TIEImageEnGlobalSettings.VScrollWidth.html
https://www.imageen.com/help/TImageEnMView.ThumbSizeInfo.html


Something like:

procedure Tfrmmain.ImageEnMView1ImageAdded(Sender: TObject; idx: integer);
begin
  newWidth := ImageEnMView1.ThumbSizeInfo( itsOuter ).X;
  if ImageEnMView1.CurrentScrollBars = ssVertical then
    inc( newWidth, IEGlobalSettings().VScrollWidth() );
  ImageEnMView1.Width := newWidth;
end;


Though, I see this does not handle it when the image count is then reduced, so I'll need to check our event handling and come back to you.

Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page

PeterPanino

982 Posts

Posted - Oct 29 2017 :  15:47:56  Show Profile  Reply
Thanks, I have solved this now in a very nice way.
Go to Top of Page

xequte

39053 Posts

Posted - Oct 29 2017 :  23:53:56  Show Profile  Reply
Cool.

FYI, in v7.0.2, a better method will be as follows:


procedure Tfrmmain.ImageEnMView1Changed(Sender: TObject);
const
  HORZ_PADDING = 8;
var
  newWidth: Integer;
begin
  // Widen control if scrollbar is visible
  newWidth := ImageEnMView1.ThumbSizeInfo( itsOuter ).X + HORZ_PADDING;
  if ImageEnMView1.CurrentScrollBars = ssVertical then
    inc( newWidth, IEGlobalSettings().VScrollWidth() );
  ImageEnMView1.Width := newWidth;
end;


Nigel
Xequte Software
www.xequte.com
nigel@xequte.com
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: