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
 How to scroll a TImageEnMView to the top?
 New Topic  Reply to Topic
Author Previous Topic Topic Next Topic  

PeterPanino

933 Posts

Posted - Dec 27 2016 :  19:53:36  Show Profile  Reply
How can I scroll a TImageEnMView to the top?

With a TScrollBox you could use:

if ScrollBox.VertScrollBar.IsScrollBarVisible then
  ScrollBox.VertScrollBar.Position := 0;


But TImageEnMView does not have these Scrollbar properties. So how can I scroll a TImageEnMView to the top?

klausdoege

Germany
389 Posts

Posted - Dec 28 2016 :  03:42:57  Show Profile  Reply
Hello Peter,
Simply set the cursor to image 0 with:
ImageEnMView1.SelectedImage := 0;


Klaus
www.klausdoege.de
Go to Top of Page

PeterPanino

933 Posts

Posted - Dec 28 2016 :  06:06:41  Show Profile  Reply
Hello Klaus,

thank you for your advice.

ImageEnMView1.SelectImage works only indirectly. Isn't there a DIRECT way to scroll to the top?
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 28 2016 :  11:34:27  Show Profile  Reply
ImageEnMView1.Seek(ieioSeekFirst);

I recommend you spend some time studying the help file. This is fully described in the help file.

TImageEnMView.Seek

Declaration

function Seek(Page : TIEIOSeekDestination) : integer;

Description

When DisplayMode is mdSingle then Seek sets VisibleFrame to display the first/previous/next/last image. Otherwise it sets SelectedImage to move the selection to the first/previous/next/last image. Returns the new page index.


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

PeterPanino

933 Posts

Posted - Dec 28 2016 :  12:54:16  Show Profile  Reply
Bill, thanks for trying to help. Your advice works, but it does not answer my question to DIRECTLY scroll to the top. Both "Seek" and "SelectImage" go to the top image and only as a SECONDARY EFFECT the control scrolls to the top.

My original question has nothing to do with the images but with the SCROLLING of TImageEnMView. Although for the user there may be no difference, from the programming point of view these are two completely different things.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 28 2016 :  13:00:21  Show Profile  Reply
I do not understand your question... "Isn't there a DIRECT way to scroll to the top?" My reply answered this question. Scrolling by setting the Selected Image := 0 is the same as Seek(ieioSeekFirst);

Your question does not make any sense to me.

Anyway... there is one more way:

TImageEnMView.SelectSeek

Declaration

procedure SelectSeek(pos: TIESeek);

Description

Moves the selection by the method specified by pos. SelectSeek will scroll the view, where necessary, to ensure the newly selected image is visible.

You can also simulate vertical scrollbar position with ViewY:
Declaration

property ViewY: integer;

Description

ViewY is the first row visible at the top-left corner of the control, in pixels (for example, if the user has scrolled vertically by two columns then it will return 2 * ThumbHeight). It is not relevant if GridWidth = 0 (in which case it always returns 0).

You can set ViewY to simulate vertical scrollbar movement.

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

PeterPanino

933 Posts

Posted - Dec 28 2016 :  13:20:25  Show Profile  Reply
SelectSeek "Moves the selection...", as the help file states.

Again: My question has nothing to do with the CONTENT of TImageEnMView but with its SCROLLBARS. Scrollbars can be programmatically moved which has nothing to do with the CONTENT of the control, although both the content and the scrollbars are synchronized by underlying code. Look at the Scrollbox code example at the top of this page.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 28 2016 :  13:22:45  Show Profile  Reply
As you simulate the vertical scrollbar position, the frames in the client area of the control changes. There is no way to scroll and not have the content change. With your example:
if ScrollBox.VertScrollBar.IsScrollBarVisible then
ScrollBox.VertScrollBar.Position := 0;
the visibility of the contents of the scrollbox will change.

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

PeterPanino

933 Posts

Posted - Dec 28 2016 :  13:35:39  Show Profile  Reply
That's what I wanted to achieve. But not by using a content selection but by programmatically moving the scrollbar to the top. Also with a TScrollBox, when scrolling to the top with the example code the content also moves.
Go to Top of Page

w2m

USA
1990 Posts

Posted - Dec 28 2016 :  13:39:39  Show Profile  Reply
If you do not want to have a frame selected then just call ImageEnMView1.Deslect after scrolling, regardless of the way you scroll the component.

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

38609 Posts

Posted - Dec 29 2016 :  01:13:44  Show Profile  Reply
Hi Peter

You can set ViewY := 0;

http://www.imageen.com/help/TImageEnMView.ViewY.html

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

PeterPanino

933 Posts

Posted - Dec 29 2016 :  04:13:27  Show Profile  Reply
Thanks Nigel!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
Jump To: