![]() |
Ribbon Control on Dialog Box |
Post Reply ![]() |
Author | |||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() Posted: 30 September 2009 at 11:45pm |
||||
Hey I'm trying the trial and when I make the ribbon bar on my dialog box, I create everything in OnInitDialog();. I figure this has something to do with the buttons and everything else on the ribbon bar functioning properly, but I honestly have no clue how I could fix it. When I compile and launch my app, I can click any button, but as soon as I click a button or any sort of control, it all goes grey and I can't click any of them again. Could someone please explain what to do to fix this issue? I imagine its not a big fix, I just can't think of how to do it as I'm completely new to CodeJock and I'm just trying it out.
Please note this is on a dialog, not MDI or SDI. Edit: Also, when I add the ribbon controls, it adds a lot of extra space to my dialog on the bottom. When I place something at the bottom of the dialog box in the editor and then compile and run, there is a lot of empty space at the bottom. I suppose this is also how I am implementing the code? |
|||||
![]() |
|||||
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
||||
Without seeing your project it is hard to say. But I can guarantee that it will work, just a matter of seeing what you do wrong. A few things to try.
Do you handle OnKickIdle?
As far as the empty space, maybe you need to handle the sizing.
|
|||||
![]() |
|||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
||||
Hey SuperMario, thank you for your response!
I have attached my project so you can take a look at it, since you said its hard to say without seeing the project. Last night I was up changing stuff around, trying to figure how to fix it, so there may be a few issues somewhere in the code. But I just tried to compile and it compiled just fine. I couldn't figure how to add the code you suggested (when I tried adding it, it wouldn't work). So I figured giving you the source would probably be best. |
|||||
![]() |
|||||
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
||||
Haven't had time to look at the sample, here is an old one I dug up, I think all you need to do is update the rc2 file with code from a current ribbon sample.
http://forum.codejock.com/uploads/20080917_022718_ds.zip |
|||||
![]() |
|||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
||||
I'm getting the exact same issue with that one. And when I attempt to add a 2nd tab and write anything in it, it doesn't appear until I minimize the ribbon control then click on the tab (in which case its still locked out, and it ONLY shows when the ribbon control is supposed to be hidden). Edit: Everything is now drawing PERFECTLY, but I still can't click it, it keeps everything locked out. And the size issue has been corrected as well. |
|||||
![]() |
|||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
||||
Sorry for the double post.
Its all drawing perfectly. Now the issue is when I click on the checkbox, it auto-unchecks itself. When I use the code:
the checkbox's all automatically uncheck themselves (except 3... which is extremely random). And when I use the code:
then the checkbox stays clicked no matter what (of course, since it equals 1, I just did this to show something is wrong within this function). I have even tried something like this:
and used ON_COMMAND and ON_UPDATE_COMMAND_UI instead (for the OnUpdateCheckbox function). But the same issue occurs. Do you think you may know what is the issue is? I've also tried:
But again, it doesn't stay checked. Is this just a bug and CodeJock Ribbon controls shouldn't be used on dialog boxes? |
|||||
![]() |
|||||
SuperMario ![]() Admin Group ![]() ![]() Joined: 14 February 2004 Status: Offline Points: 18057 |
![]() ![]() ![]() ![]() ![]() |
||||
I don't see where you update the command:
From header: void OnUpdateViewShowHide(CCmdUI* pCmdUI); void OnViewShowHide(UINT nID); BOOL m_bOptions[6]; Source: ON_UPDATE_COMMAND_UI_RANGE(ID_VIEW_RULER, ID_VIEW_THUMBNAILS, OnUpdateViewShowHide) ON_COMMAND_RANGE(ID_VIEW_RULER, ID_VIEW_THUMBNAILS, OnViewShowHide) ZeroMemory(&m_bOptions, sizeof(m_bOptions)); void CMainFrame::OnViewShowHide(UINT nID) { m_bOptions[nID - ID_VIEW_RULER] ^= 1; } void CDialogSampleDlg::OnUpdateViewShowHide(CCmdUI* pCmdUI) { pCmdUI->SetCheck(m_bOptions[pCmdUI->m_nID - ID_VIEW_RULER] ? TRUE : FALSE); } If that don't he;[ post your sample again and we will fix it. |
|||||
![]() |
|||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
||||
Ok its fixed. Thank you! I was forgetting the "? TRUE : FALSE" and the ZeroMemory.
Now one last question ( I think ), when I try to do anything like:
It doesn't work and the code messes up again. Where can I add the code to make my app do something when the checkbox is checked? And I'm actually using:
and
for a single checkbox. My functions look like:
and
So how/where would I add code to make it do something when checked? I know I can't put it in OnViewShowHide or OnUpdateViewShowHide, as it messes up and the checkbox doesn't operate properly after that. And when I tried putting the code in OnInitDialog, it of course didn't work. But I was trying any options I had. Also, I put ZeroMemory in my OnInitDialog. It works, but is that where you wanted me to put it? |
|||||
![]() |
|||||
Oleg ![]() Admin Group ![]() Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
![]() ![]() ![]() ![]() ![]() |
||||
You need if ( bCheckbox == TRUE )
{ // Code in here } instead of
if ( bCheckbox = TRUE )
{ // Code in here } |
|||||
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|||||
![]() |
|||||
EASX ![]() Newbie ![]() ![]() Joined: 30 September 2009 Status: Offline Points: 7 |
![]() ![]() ![]() ![]() ![]() |
||||
Alright thanks, it works perfectly... I felt like the answer was right in front of me. I feel so foolish
![]() |
|||||
![]() |
Post Reply ![]() |
|
Tweet
|
Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |