|
Is there possible to assign to a static object a bk (like SetBitmap for MFC)
|
|
|
|
|
Move your background blitting codes to OnEraseBkgnd(...)
|
|
|
|
|
I have a Visual C++/MFC app that plots several graphs based on the same data. On each graph I draw a cursor or position point based on time. This is all done during a 'playback' mode.
The cursor/position is being drawn and redrawn correctly but if I switch applications it sometimes leaves a 'stranded' cursor. This is apparenly because only the region that was previously hidden is redrawn.
How can I get OnDraw() to refresh the entire client area of the affected window?
|
|
|
|
|
I believe the default call to Invalidate will Invalidate the entire region
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
That is correct Invalidate() will cause the entire region to be redrawn. The question, i suppose, is where does one call this function? The OnDraw() function gets called when the window needs to be redrawn but calling Invalidate() here results in a cascade of messages.
Carter
|
|
|
|
|
There are several way to do that. One of the simplest would be to set a timer inside OnDraw() when the condition exists. Then in the Timer event handler you can call Invalidate().
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
Thanks for the advice, Pete.
What I ended up doing is just hiding the cursor in the OnPaint() event. Restoring it after the EndPaint(). Quicker than redrawing the entire form too.
Carter
|
|
|
|
|
Hello,
I am very inexperienced in C++, so please bear with my question:
I am created a class "Tables" which is composed of an array of type "Columns" (another class i have created -- with its own attributes).
In "Tables.h" I have this initialization:
Columns t_Columns[45];
and in a method called "createTable" which is defined in "Tables.cpp" I have this code:
for(int i = 0; i < 45; i++)
{
t_Columns[i] = new Columns();
}
As you can guess, i want 45 instances of Columns in my Table.
My Problems is that the array cannot access any of the methods or attributes of the Column Class still.
I have even tried this:
in Table.h:
Columns * t_Columns[45]
in Table.cpp:
for(int i = 0; i < 45; i++)
{
*(t_Columns + i) = new Columns();
}
Can someone please point me in the right direction, i would be so grateful!
thanks in advance
|
|
|
|
|
I just found a solution: don't use the ".cpp" file for class definition, just define the class in ".h"
At least now it appears to be picking up the attributes of "Columns" class.
|
|
|
|
|
So and So wrote:
Columns t_Columns[45];
.
.
t_Columns[i] = new Columns();
Your t_Columns is an array of Columns objects so you can't 'new' it. It is already created.
So and So wrote:
Columns * t_Columns[45];
.
.
*(t_Columns + i) = new Columns();
Now you can 'new' it but you should write it as:
t_Columns[i] = new Columns();
<font=arial>Weiye Chen
When pursuing your dreams, don't forget to enjoy your life...
|
|
|
|
|
Hi everyone, I'm working on this program for work,and Im trying to create a clock at the bottom right hand side of the screen in a status bar so it shows the user how long theyhave been using the program. the clock should work like this. First when the user first starts the program the clock will be at 00:00:00, and then 1 second later itll be at 00:00:01, and then two seconds later itll be at 00:00:02, and so on. Ive been looking everywhere on the net, but I havent been able to find anything. Im coding in C++ and using Win32 programming NOT the MFC's.
if u have an answer for me, email me at osalman@csulb.edu. or just reply here. Thank you all for your time!
|
|
|
|
|
I dont know how to put the time at the status bar, but time since process started can be found by clock() function
http://www.cplusplus.com/ref/ctime/clock.html
|
|
|
|
|
Well the code that was there are all for a windows console program. Im trying to make a Win32 GUI program. My clock should work like a clock on a MIDI program in the sense the user can see the seconds going by and what not. Do you have any examples of that.
Thanks for all your help.
|
|
|
|
|
Create a statusbar pane (eg: with id IDC_CLOCK_PANE ) and write a ON_UPDATE_COMMAND_UI handler for it which sets the pane's text to the current time.
void CMainFrame::OnUpdateClockPane
(CCmdUI* pCmdUI)
{
ASSERT (NULL != pCmdUI);
pCmdUI->SetText (CTime::GetCurrentTime().Format(_T("...")));
} Oh wait - you're not using MFC. In that case, you could create a one second timer (actually slightly less than 1 sec) and update the main window's status bar's pane within the handler for WM_TIMER .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Well the thing is, I dont know how to make the clock appear on my window. I was wondering if anyone knew how to do that. I dont know how to create it at all.
|
|
|
|
|
I think Nishant's status bar article is what you are looking for, with a little modification for your needs.
http://www.codeproject.com/statusbar/dlgstatbar01.asp
Since you want to show total running time, you can first record and store the initial time upon application's startup. And the on every OnTimer() function call, take the difference between the initial time and the current time and output on the status bar.
|
|
|
|
|
Hi,
Can anyone give me some pointer on how I can make some IE browser addons like Google toolbar/yahoo tollbar.
Thanks
|
|
|
|
|
A CodeProject search for "ie toolbar" will yield several examples.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi all...
(* long time no seen *)
For months and months I try to find out...
What is the formula behind the sinus,
because I want to do my own sinus function (Ex. double MySin(double) )
Please heeelp me...
Any kind of help will be greatly appreciated
=-=-=-=-=-=-=
The Server
|
|
|
|
|
|
Can someone tell me where I can find some good info, on packing structures and alignment. I have never quite understood the topic.
I have to pack some structures in my Windows application.
Thanks.
Jerry
|
|
|
|
|
Start with the #pragma pack() directive.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
|
Hai,
I'm using win32 vc++. I'm drawing the background for my button by subclassing.
But at no. of times I'm enabling and disabling the button in my dialog procedure(not in subclass proc). At those times how can I display the text in button as grey ie. how can I retrieve the text from the button and grey it?
Thanks a lot.
|
|
|
|
|
Does GetWindowText work??
"Fish and guests stink in three days." - Benjamin Franlkin
|
|
|
|