|
Could you explain your problem a little more clearly? What do you mean when you say the line is drawn on the backsite of the window? Did you open your monitor to see if a line was there?
|
|
|
|
|
I want add buttons to toolbar dynamicly, also delete them dynamicly.
when I added button to toolbar, the button is gray,,
How can i make the newly added buttons active or avalible to the click command, so that i can use the buttons to control something i want.
|
|
|
|
|
Did you set the button state? In the fsState member of TBBUTTON structure, you might need to set the TBSTATE_ENABLED state also.
It also depends on whether you are using MFC or not.
this is this.
|
|
|
|
|
thank you for your reply/
I use the MFC ,and also i set the enabled state ...
how to make the buttons recieve the message which produced by mouse click?
bruspark
|
|
|
|
|
Add a handler function prototype in CMainFrame or the class which will handle the click like:
afx_msg void OnSome();
Also in the .cpp file, add this to the Message map:
ON_COMMAND(ID_SOMETHINGELSE,OnSome)
Also define ID_SOMETHINGELSE to be the same as the command-id of the button for which you want to handle the click.
Then send message:
SendMessage(WM_COMMAND,MAKELPARAM(ID_SOMETHINGELSE,0));
//If sent from the same class as the handler.
Also define the function in the .cpp file:
void CClassname::OnSome()<br />
{<br />
}
this is this.
|
|
|
|
|
khan++,thank you for you reply!
It's a good idea...I will try it.
Thank you!
|
|
|
|
|
The problem is :when i create a button in toolbar,i got the ID of the button,but how can i make the buttons recieve the click event ?
with the classwizard we can map the command to the buttonID,when i click the buttons,handler fuction is called...
however,now ,the buttons is created dynamicly,and we don't know the buttonID in advance.The classwizard can't work in this case.
i can call the PostMessage() fucntion to inform the buttons created dynamicly. the problem is how can the buttons recieved the click event and
where do i place the message handler fuctions?
|
|
|
|
|
Have you add this macro to the map
ON_COMMAND(ID_BUTTON, OnClickButton)
?
or
ON_COMMAND_RANGE
if you have more ID/buttons dynamically created
?
Have a nice code day
|
|
|
|
|
_Russell,I add the ON_COMMAND_RANGE macro ,,it works...
Thanks a lot!
|
|
|
|
|
Have a nice code day
|
|
|
|
|
|
Hi bruspark
I think
if your buttons are gray you need to functions for button and check Id from Buttons
|
|
|
|
|
When you created the toolbar and filled in the members of the TBBUTTON struct, you can set the initial state of the button. You should use TBSTATE_ENABLED to enable them and 0 to gray them. You can then use the TB_ENABLEBUTTON message to programatically enable/disable the buttons.
To show and hide buttons you can use the TB_HIDEBUTTON message.
|
|
|
|
|
Hi waldermort,
you can post your answer to sender(bruspark) not me
|
|
|
|
|
Ah sorry, I will remember that in future.
|
|
|
|
|
The problem is :when i create a button in toolbar,i got the ID of the button,but how can i make the buttons recieve the click event ?
with the classwizard we can map the command to the buttonID,when i click the buttons,handler fuction is called...
however,now ,the buttons is created dynamicly,and we don't know the buttonID in advance.The classwizard can't work in this case.
i can call the PostMessage() fucntion to inform the buttons created dynamicly. the problem is how can the buttons recieved the click event and
where do i place the message handler fuctions?
|
|
|
|
|
The problem is :when i create a button in toolbar,i got the ID of the button,but how can i make the buttons recieve the click event ?
with the classwizard we can map the command to the buttonID,when i click the buttons,handler fuction is called...
however,now ,the buttons is created dynamicly,and we don't know the buttonID in advance.The classwizard can't work in this case.
i can call the PostMessage() fucntion to inform the buttons created dynamicly. the problem is how can the buttons recieved the click event and
where do i place the message handler fuctions?
bruspark
|
|
|
|
|
bruspark wrote: the button is gray
Maybe the whole toolbar is disabled : MyToolbar->EnableWindow(TRUE);
Another good read[^]
~RaGE();
|
|
|
|
|
Hi all,
Can anybody help me to reposition the default tooltip that is shown by a treectrl when the item text is clipped inside the ctrl?
I simply want to avoid the clipping of this tooltip when the ctrl is near to right edge of the screen. In this case the default tooltip is clipped by the screen. So I want to move it to left to avoid this clipping.
For example, the treectrl of the workspace in VC-6 IDE is doing the same. If we placed the worksapce toolwindow to right, the tooltip will not go outside of the screen.
Thank you.
- NS -
|
|
|
|
|
NS17 wrote: For example, the treectrl of the workspace in VC-6 IDE is doing the same. If we placed the worksapce toolwindow to right, the tooltip will not go outside of the screen.
NS17 wrote: Can anybody help me to reposition the default tooltip that is shown by a treectrl when the item text is clipped inside the ctrl?
This depends on the mouse position. Tooltips always appear relative to your mouse position.
NS17 wrote: I simply want to avoid the clipping of this tooltip when the ctrl is near to right edge of the screen. In this case the default tooltip is clipped by the screen. So I want to move it to left to avoid this clipping.
You will have to sublcass CToolTipCtrl and handle TTM_POPUP . Check mouse co-ordinates to display tooltips accordingly.
Nibu thomas
Software Developer
|
|
|
|
|
Hi
Have what I think is a pretty easy question for most of you,
but I dont know how to solve it unfortunately... so here goes.
Have programmed a Progressbar in a dialogue and want to keep
track of the progress. Works perfect, but sometimes the entire
window stops updating during the calculation and only updates
when everything is 100% done. The same effect can be simulated
when some other window gets focus, then my main window does
not update anymore until the function is done.
Have tried things like:
CWnd *Main=AfxGetMainWnd();
Main->RedrawWindow();
in my function to update the window, but it does not work.
Any one of you have a simple solution?
Regards
Abris
|
|
|
|
|
Abris wrote: Have programmed a Progressbar in a dialogue and want to keep
track of the progress. Works perfect, but sometimes the entire
window stops updating during the calculation and only updates
when everything is 100% done
Use a Timer.
For more info take a look at WM_TIMER .
Nibu thomas
Software Developer
|
|
|
|
|
Use Thread to update the Progress bar,
|
|
|
|
|
You can write the thread that will update ur progressbar window as well in the mean time you can handle other stuff.
Knock out "T" from CAN'T
You 'CAN' if you think you 'CAN'
-- modified at 4:16 Monday 3rd April, 2006
|
|
|
|
|
Hmmm, seems like threads is the solution then?
Tried the Timer thing, but it did not work at all.
Added the following code to the OnTimerEvent in my main dlg.
this->Invalidate();
this->UpdateWindow();
this->RedrawWindow();
m_TheFileDownLoadProgress.RedrawWindow();
m_TheDownLoadProgress.RedrawWindow();
When inside the Filedownload function and the dlg looses
focus this code does not help however, it still does not update
the Progress bar. Only thing that it gave me was an very annoying
blinking window from all the updates
Threads I have so far never tried, seems like a complicated
solution? I'll take a look, but I would have guessed there was
some simpler way to do it....
|
|
|
|