|
Assuming that you mean UINT rather than UNIT you just need to cast it thus:
UINT uIntValue = 100;
int intValue = uIntValue;
Be aware that any values greater than 2147483647 (0x7FFFFFFF) will be negative in the resulting integer.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Thank you, I understand. But the source is so written.
for (UINT uiLineStyleCmd = ID_LINE_STYLE_1;
uiLineStyleCmd <= ID_LINE_STYLE_10;
uiLineStyleCmd++)
{
int iIndex = pMenuPopup->GetMenuBar ()->CommandToIndex (uiLineStyleCmd);
if (iIndex >= 0)
{
pMenuPopup->GetMenuBar ()->m_bDisableSideBarInXPMode = TRUE;
//----------------------------
// Obtain item text and style:
//----------------------------
CString strText = pMenuPopup->GetMenuBar ()->GetButtonText (iIndex);
UINT uiStyle = pMenuPopup->GetMenuBar ()->GetButtonStyle (iIndex);
//------------------
// Calc. line width:
//------------------
int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
//-------------------
// Replace menu item:
//-------------------
pMenuPopup->GetMenuBar ()->ReplaceButton (uiLineStyleCmd,
CLineStyleMenuItem (nWidth,
uiLineStyleCmd,
strText,
uiStyle & TBBS_CHECKED));
}
|
|
|
|
|
Firstly, please use <pre> tags around your code and ensure that it is formatted properly. Secondly, what is your problem?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Please do not use direct eamil to update details of open issues.
You responded to my question:
Message from dlsyaim:
Source is defined so
#define ID_LINE_STYLE_1 32833
But UINT 0 - 4294967295
Source code is no problem
What exactly does this mean, and what is your problem?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
In MFC. I added BCGControlBar control, I do not know how to load line type, source of these. Our manager let me look at this change.
// Replace ID_VIEW_TOOLBARS menu item to the toolbars list:
//---------------------------------------------------------
if (pMenuPopup->GetMenuBar ()->CommandToIndex (ID_VIEW_TOOLBARS) >= 0)
{
if (CBCGPToolBar::IsCustomizeMode ())
{
//----------------------------------------------------
// Don't show toolbars list in the cuztomization mode!
//----------------------------------------------------
return FALSE;
}
pMenuPopup->RemoveAllItems ();
CMenu menu;
VERIFY(menu.LoadMenu (IDR_POPUP_TOOLBAR));
CMenu* pPopup = menu.GetSubMenu(0);
ASSERT(pPopup != NULL);
pMenuPopup->GetMenuBar ()->ImportFromMenu (*pPopup, TRUE);
}
//-------------------------------------------------------------------
// Replace all "line style" menu items by CLineStyleMenuItem objects:
//-------------------------------------------------------------------
for (UINT uiLineStyleCmd = ID_LINE_STYLE_1;
uiLineStyleCmd <= ID_LINE_STYLE_10;
uiLineStyleCmd++)
{
int iIndex = pMenuPopup->GetMenuBar ()->CommandToIndex (uiLineStyleCmd);
if (iIndex >= 0)
{
pMenuPopup->GetMenuBar ()->m_bDisableSideBarInXPMode = TRUE;
//----------------------------
// Obtain item text and style:
//----------------------------
CString strText = pMenuPopup->GetMenuBar ()->GetButtonText (iIndex);
UINT uiStyle = pMenuPopup->GetMenuBar ()->GetButtonStyle (iIndex);
//------------------
// Calc. line width:
//------------------
int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
//-------------------
// Replace menu item:
//-------------------
pMenuPopup->GetMenuBar ()->ReplaceButton (uiLineStyleCmd,
CLineStyleMenuItem (nWidth,
uiLineStyleCmd,
strText,
uiStyle & TBBS_CHECKED));
}
}
|
|
|
|
|
Please edit this post and put <pre> tags around your code as I asked. Please also explain exactly what problem you are having.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
dlsyaim wrote: int nWidth = uiLineStyleCmd - ID_LINE_STYLE_1 + 1;
Is this the statement in question? If so, what is the compiler error or warning that you are receiving?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi. I have a SDI app, with CView based on CListView. In edit menu, I enable / disable some items dependes some conditions with :
ON_UPDATE_COMMAND_UI(ID_EDIT_REFRESH, OnUpdateEditRefresh)
the same edit menu I load in right-click :
void CMyView::OnRclick(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
CMenu menu;
menu.LoadMenu(IDR_TERMTYPE2);
CMenu* pContextMenu = menu.GetSubMenu(1);
POINT point;
CPoint pt(pNMListView->ptAction);
point.x = pt.x;
point.y = pt.y;
::ClientToScreen(pNMHDR->hwndFrom,&point);
int nID = pContextMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON | TPM_RETURNCMD,point.x,point.y,this);
*pResult = 0;
}
but all items from edit menu are enable ... and I must enable/disable depndes by the same conditions like main edit menu ... my question is, how can enable/disable edit menu items in OnRclick handler but some how using ON_UPDATE_COMMAND_UI ?
|
|
|
|
|
See this[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I solve my problem ! Thank you very much !
|
|
|
|
|
Congrats and yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
It's always a pleasure to be on this forum ! Happy new year !
|
|
|
|
|
Thanks, a happy new year to you too!
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
I made a window that holds a listbox of users, you click on one, and you can edit the values. I was going to make a new window, and tried a dialog box, but there was no textboxes, I didn't find one.
So now I'm thinking, just create 2 panels or groups, and toggle them show and hide.
Question:
Is there such a thing in c++ win32, and what would it be called>
|
|
|
|
|
Jim,
I have absolutely no idea what you are describing. Maybe it has something to do with the post below yours... I can't get this Tic-Tac-Toe song by Kyper[^] out of my head now.
Maybe you could give a better description of what you are attempting to do. Keep in mind that most of the window classes are very basic in what functionalities they provide.
Best Wishes,
-David Delaune
|
|
|
|
|
I want to group a collection of textboxes, labels and buttons, and store it as a single object that I can make visible or invisible.
I was just thinking maybe a plain CreateWindow could do the job, but for now, I'm not sure if it's possible to do, and the name it would be refereed to as - nomenclature.
|
|
|
|
|
Hey Jim,
jkirkerx wrote: I want to group a collection of textboxes, labels and buttons, and store it as a single object that I can make visible or invisible.
I am sure that you are already familiar with the parent/child relationship with windows; If you hide a parent window all of its children are non-visible.
Intentional paronomasia: Thinking outside the box... In your InitDialog() or perhaps OnSize() you could get the rectangle of the group box and set all windows with the Top/Left point that are within the group box rect... to be child windows of the group box. Now when you hide the groupbox... all child windows will also be hidden.
It may also be be possible to do something with ON_CONTROL_RANGE[^] to control/hide all of them at once. All you need to do to implement this is give them ID's of a contiguous range... 100, 101, 102, 103, 104, ...
That's all I can think of for now.
Best Wishes,
-David Delaune
|
|
|
|
|
Thanks Dave.
I already wrote code for the form, in which I used CreateWindow to make a series of Labels and a Textboxs to create a form, and I just wanted to use the same code over again.
I found the textbox in the dialog form editor toolbox, and created the same form again in dialog format as well. What a pain, it was easier to just write code instead of using the gui.
I'll experiment with the window you suggested and the dialog form and see which one I like better.
I've been in the web world for a long time, and could not phrase what I was looking for.
|
|
|
|
|
Hey Jim,
jkirkerx wrote: I already wrote code for the form, in which I used CreateWindow to make a series of Labels and a Textboxs to create a form, and I just wanted to use the same code over again.
Actually... if you are dynamically creating those controls... its even easier... the CreateWindow function[^] will allow you to set the hWndParent . All you would need to do is set the parent to the groupbox handle.jkirkerx wrote: I've been in the web world for a long time, and could not phrase what I was looking for.
Yep, no problem; we all have areas of expertise and other subjects where we get a little lost.
Best Wishes,
-David Delaune
|
|
|
|
|
jkirkerx wrote: ...but there was no textboxes, I didn't find one.
You have to add them (in the resource editor). Controls don't just automatically appear.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hello!
I'm trying to insert a bitmap into the game board of tic tac toe.
When the user clicks left mouse button on the board bitmap loads from file and draws itself on the screen.
This is the part of code I want to change. Polje is a vector, a two dimensional field. Velicina is the size of the board(3X3, 6X6, 9X9)
pDC->SetBkColor(color);
for (int i = 0; i < velicina; ++i)
for (int j = 0; j < velicina; ++j)
if(pDoc->polje.at(i).at(j) > 0)
{
pDC->TextOutW(rc.left + j * 50 + 20, rc.top + i * 50 + 20, pDoc->polje.at(i).at(j) == 1 ? _T("X") : _T("O"), 1);
}
Thank you for your help.
|
|
|
|
|
And what is your question?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
My question is how to insert a bitmap into the game board of tic tac toe from file.
User clicks on the board with the left mouse button and the bitmap shows.
I'm making tic tac toe with bitmaps instead of X or O.
|
|
|
|
|
I guess you will need LoadImage[^] to load the bitmap from file, attach it to a CBitmap[^] object with CBitmap::Attach[^]. Then you can use the good-old CDC::BitBlt[^] to render the bitmap. See the example here[^].
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Thank you for your answer.
|
|
|
|