BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ScrollBar Behaviour

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development)
View previous topic :: View next topic  
Author Message
goldrake
Guest





PostPosted: Fri Apr 20, 2007 10:11 pm    Post subject: ScrollBar Behaviour Reply with quote



hi Users,

i need to know how to change the default behaviour of a scroll bar
( for computational trouble I need to update only after I moved the
scroll bar and not in realtime).

i found this post (1999) :
http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_th...

could someone please give me a more exaustive little example, the
above is not so clear for me, or maybe in meanwhile something is
changed? i'm using turbo c++ 2006

thank tou very much in advance.

jack.
Back to top
JD
Guest





PostPosted: Sat Apr 21, 2007 1:38 am    Post subject: Re: ScrollBar Behaviour Reply with quote



goldrake <jack_doctor (AT) hotmail (DOT) com> wrote:
Quote:

[...] I need to update only after I moved the scroll bar
and not in realtime).

Is that all? For example, an OnBeginScroll event and
OnEndScroll event where you can call BeginUpdate and
EndUpdate?

Quote:
i found this post (1999) :
http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_th...

Broken link.

~ JD
Back to top
goldrake
Guest





PostPosted: Sat Apr 21, 2007 5:01 am    Post subject: Re: ScrollBar Behaviour Reply with quote



On 20 Apr, 22:38, "JD" <nos...@nospam.com> wrote:
Quote:
goldrake <jack_doc...@hotmail.com> wrote:

[...] I need to update only after I moved the scroll bar
and not in realtime).

Is that all? For example, an OnBeginScroll event and
OnEndScroll event where you can call BeginUpdate and
EndUpdate?

hi jd, thank you for your answer.

I searched but non found these event(OnBeginScroll, OnEndScroll ) in
my default TScrollBar bar events list.
can you give me some explanation?


I'm triing rigth now this schema code:


void __fastcall TForm1::ScrollBarScroll(TObject *Sender,
TScrollCode ScrollCode, int &ScrollPos)
{
Label1->Caption = ScrollPos; // changes whenever you move

if(ScrollCode == scPosition)
{
ScrollPos=0; // changes after you release
}
}






Quote:

i found this post (1999) :
http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_th...

Broken link.

~ JD
Back to top
Hans Galema
Guest





PostPosted: Sat Apr 21, 2007 3:22 pm    Post subject: Re: ScrollBar Behaviour Reply with quote

goldrake wrote:

Quote:
i need to know how to change the default behaviour of a scroll bar

Do you mean a TScrollBar ?

Quote:
( for computational trouble I need to update only after I moved the
scroll bar and not in realtime).

What do you mean by that? Do you mean after the /slider/ moved?

On which of the many actions a user can perform on a TScrollBar you need help?


Quote:
i found this post (1999) :
http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_th...

That is an incomplete link and so does not work.

Quote:
could someone please give me a more exaustive little example, the
above is not so clear for me, or maybe in meanwhile something is
changed? i'm using turbo c++ 2006

What is exactly your problem?

Hans.
Back to top
goldrake
Guest





PostPosted: Sat Apr 21, 2007 9:24 pm    Post subject: Re: ScrollBar Behaviour Reply with quote

On 21 Apr, 12:22, Hans Galema <notu...@notused.nl> wrote:
Quote:
goldrake wrote:
i need to know how to change the default behaviour of a scroll bar

Do you mean a TScrollBar ?

( for computational trouble I need to update only after I moved the
scroll bar and not in realtime).

What do you mean by that? Do you mean after the /slider/ moved?

On which of the many actions a user can perform on a TScrollBar you need help?

i found this post (1999) :
http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_th...

That is an incomplete link and so does not work.

could someone please give me a more exaustive little example, the
above is not so clear for me, or maybe in meanwhile something is
changed? i'm using turbo c++ 2006

What is exactly your problem?

Hans.


hi Hans, thank you very much for your answer, the correct link is:

http://groups.google.it/group/borland.public.cppbuilder.vcl/browse_thread/thread/827f7cec26c9e3a/


My problem is related to default behaviour of scroll bar: I want to
update my code only after bar change ( when I release bar control
moved with mouse) , not continuosly or pressing side bar arrows.


but using this approach and ONSCROLL event :

1 void __fastcall TForm1::ScrollBarScroll(TObject *Sender,
2 TScrollCode ScrollCode, int &ScrollPos)
3 {
4 Label1->Caption = ScrollPos; // this is called continuosly
moving the bar control with mouse
5 if(ScrollCode == scPosition)
6 {
7 ScrollPos=0; // this is called after release mouse button
8 }
9 }

it works but I found a side effect:
- when i press the side bar arrows or moving the trackbar line 4 is
continuosly called ( it is ok)
- releasing the bar line 7 is called ( it is ok)...but after this line
4 is called another time (this is the side effect)....and i do not
want this extra call to line 4.

i modified code as a workaround to:

void __fastcall TForm1::ScrollBarScroll(TObject *Sender,
TScrollCode ScrollCode, int &ScrollPos)
{
static bool changed = true;
if(changed == true)
{
Label1->Caption = ScrollPos; // this is called
continuosly moving the bar
}
changed = true;
if(ScrollCode == scPosition)
{
ScrollPos=0; // this is called after release the bar
changed = false;
}
}

this workaround remove the side effect explained before( is it
possible to do better?) but right now i must disable side bar control
arrows ( how to do this?) to avoid incorrect execution of this code
and mantain only a direct mouse interaction of the scroll bar.


i hope i was enougth clear in explanation... Smile
Back to top
JD
Guest





PostPosted: Sun Apr 22, 2007 7:37 am    Post subject: Re: ScrollBar Behaviour Reply with quote

goldrake <jack_doctor (AT) hotmail (DOT) com> wrote:
Quote:


Please trim your posts.

First and foremost, you must be clear with what it is that
you're asking. You asked about a scroll bar in a component
writing group and it turns out that you really wanted to
know about a TScrollBar which should have been asked in the
vcl.using group instead.

Quote:
I searched but non found these event(OnBeginScroll, OnEndScroll)
in my default TScrollBar bar events list.
can you give me some explanation?

To be clear, those events do not natively exist but if you
were writing your own component, they would be easy to add.

<from your reply to Hans>

Quote:
My problem is related to default behaviour of scroll bar: I
want to update my code only after bar change (when I release
bar control moved with mouse), not continuosly or pressing
side bar arrows.

What control and why? That changes the default behavior of a
ScrollBar and when ever one changes the default behavior, one
better have a good reason.

If you fail to update the GUI when the user clicks the up or
down scroll arrow, the user will have no faith in your program
and hate you for it. If doing so is CPU intensive ... so be it.
It's the users choice to click or not click.

Quote:
but using this approach and ONSCROLL event :

1 void __fastcall TForm1::ScrollBarScroll(TObject *Sender,
2 TScrollCode ScrollCode, int &ScrollPos)
3 {
4 Label1->Caption = ScrollPos; // this is called continuosly moving the bar control with mouse
5 if(ScrollCode == scPosition)
6 {
7 ScrollPos=0; // this is called after release mouse button
8 }
9 }

it works but I found a side effect:
- when i press the side bar arrows or moving the trackbar
line 4 is continuosly called ( it is ok)

No kidding it's always called because you're calling it
unconditionally!

Quote:
- releasing the bar line 7 is called ( it is ok)...but after
this line 4 is called another time (this is the side effect)
....and i do not want this extra call to line 4.

The don't set the ScrollPos like you are doing.

Quote:
i modified code as a workaround to:

You failed to include how you were using the TScrollBar with
what type of control so specifics are impossible. However, I
can say that I have complete confidence that if you use only
scEndScroll you can get your desired results.

~ JD
Back to top
goldrake
Guest





PostPosted: Sun Apr 22, 2007 9:55 pm    Post subject: Re: ScrollBar Behaviour Reply with quote

Dear JD,
wonderful: scEndScroll is the answer. It resolve all my
problems with TScrollBar ( I'm using default components not writing my
own).
Thank you very much for your quick answer.

Jack
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (VCL Components Development) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.