| | |
Form Is Scrolling Down
Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved |
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
I wonder something. I have a Form with Vertical ScrollBars.
When running this code below that are inside a buttoncontrol when the scrollbar is at the top of the Form, the Form Scroll downs a bit, perheps 5-10 cm.
This is because I set button1->Enabled = false;
(I don´t know why the Form is scrolling down though when doing this)
Is it possible to not let the Form scroll down when running the code ?
When running this code below that are inside a buttoncontrol when the scrollbar is at the top of the Form, the Form Scroll downs a bit, perheps 5-10 cm.
This is because I set button1->Enabled = false;
(I don´t know why the Form is scrolling down though when doing this)
Is it possible to not let the Form scroll down when running the code ?
C++ Syntax (Toggle Plain Text)
button1->Enabled = false; // Code Here button1->Enabled = true;
Last edited by Jennifer84; Jun 12th, 2008 at 8:13 pm.
> Is it possible to not let the Form scroll down when running the code ?
It's hard to tell what your problem is without seeing all of the code, but to mitigate the effect of the problem you can move the scroll bar position back to 0. It's kludgy, but gives the desired effect.
> how are we supposed to guess which OS / Compiler / UI Toolkit you're using
Jennifer84 isn't new to the forum, and all of her GUI questions that Edward has seen have been about Windows Forms in C++/CLI. Do you expect her to repeat the same information in every post despite her frequent threads concerning the same API?
It's hard to tell what your problem is without seeing all of the code, but to mitigate the effect of the problem you can move the scroll bar position back to 0. It's kludgy, but gives the desired effect.

> how are we supposed to guess which OS / Compiler / UI Toolkit you're using
Jennifer84 isn't new to the forum, and all of her GUI questions that Edward has seen have been about Windows Forms in C++/CLI. Do you expect her to repeat the same information in every post despite her frequent threads concerning the same API?
If at first you don't succeed, keep on sucking until you do succeed.
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
Thank you. I use VC++ 2008 Express Edition.
I thought this perheps wasn´t so easy to know without see all the code.
The problem is that there is thousands of lines of code inside this button. : )
I tried to put it like this. It works but what happens is that the Form scroll down and
up again very fast, so it kind of ´blinks´.
It is probably not easy to know what it could depend on. I will try to experiment and
see if I can find any solution.
Why I want to Disable the button when pressing it is because if you press the button again and again very fast at the same time, you will have a "vector out of range" Error because
the calculation isn´t finished.
Perheps there could be an other way to disable it or prevent to press the button until it is finished.
button1->Visible = true; perheps isn´t the best either because calculations can take a while sometimes and the user might wonder where the button is
I thought this perheps wasn´t so easy to know without see all the code.
The problem is that there is thousands of lines of code inside this button. : )
I tried to put it like this. It works but what happens is that the Form scroll down and
up again very fast, so it kind of ´blinks´.
It is probably not easy to know what it could depend on. I will try to experiment and
see if I can find any solution.
Why I want to Disable the button when pressing it is because if you press the button again and again very fast at the same time, you will have a "vector out of range" Error because
the calculation isn´t finished.
Perheps there could be an other way to disable it or prevent to press the button until it is finished.
button1->Visible = true; perheps isn´t the best either because calculations can take a while sometimes and the user might wonder where the button is

C++ Syntax (Toggle Plain Text)
button1->Enabled = false; Form2::VerticalScroll->Value = 0; button1->Enabled = true;
Last edited by Jennifer84; Jun 13th, 2008 at 9:56 am.
> Perheps there could be an other way to disable it or prevent to press the button until it is finished.
Edward would probably use a processing flag while the calculation is running. Set the flag to true when the button is clicked--or do nothing if the flag is already set--and unset it when the calculation finishes:
That assumes you're running the calculation in a BackgroundWorker thread.
Edward would probably use a processing flag while the calculation is running. Set the flag to true when the button is clicked--or do nothing if the flag is already set--and unset it when the calculation finishes:
C++ Syntax (Toggle Plain Text)
bool _isProcessing; void buttonCalculate_Click(Object^, EventArgs^) { if (_isProcessing) return; _isProcessing = true; // Run calculation } void backgroundWorker_RunWorkerCompleted(Object^, RunWorkerCompletedEventArgs^) { _isProcessing = false; }
If at first you don't succeed, keep on sucking until you do succeed.
•
•
Join Date: Feb 2008
Posts: 517
Reputation:
Solved Threads: 1
Yes ofcourse, this is a very good idéa. I will try this approach.
Thank you...
Thank you...
•
•
•
•
> Perheps there could be an other way to disable it or prevent to press the button until it is finished.
Edward would probably use a processing flag while the calculation is running. Set the flag to true when the button is clicked--or do nothing if the flag is already set--and unset it when the calculation finishes:
That assumes you're running the calculation in a BackgroundWorker thread.C++ Syntax (Toggle Plain Text)
bool _isProcessing; void buttonCalculate_Click(Object^, EventArgs^) { if (_isProcessing) return; _isProcessing = true; // Run calculation } void backgroundWorker_RunWorkerCompleted(Object^, RunWorkerCompletedEventArgs^) { _isProcessing = false; }
![]() |
Similar Threads
- Form scrolling without using the scroll bar (Visual Basic 4 / 5 / 6)
- Printing of a Form in VB.NET? (VB.NET)
- How do I add a vertical scroll bar to a form? (Visual Basic 4 / 5 / 6)
- Scrolling Issues (Troubleshooting Dead Machines)
- Conserving resources and scrolling in files (C)
- Moving objects on a form (VB.NET)
- How to create a web page with scrolling menus to specific entries (HTML and CSS)
- HTML Form not working with IE when lots of select/option boxes included. (HTML and CSS)
- HTML Form not working with IE when lots of select/option boxes included. (Web Browsers)
- Scrolling MDI Child form (Visual Basic 4 / 5 / 6)
Other Threads in the C++ Forum
- Previous Thread: problem Implementing Stacks
- Next Thread: Help writing a simple Ymodem Send
| Thread Tools | Search this Thread |
Tag cloud for C++
api application array arrays based beginner binary bmp c++ c/c++ calculator char char* class classes code compile compiler console conversion convert count data delete deploy dll dynamiccharacterarray email encryption error file format forms fstream function functions game givemetehcodez graph gui homeworkhelp iamthwee ifstream input int java lib library lines list loop looping loops map math matrix memory newbie news number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg search simple sorting spoonfeeding string strings struct temperature template templates text text-file tree url variable vector video visual visualstudio void win32 windows winsock wordfrequency wxwidgets






