|
In the settings dialog of the task bar/start menu, there is a setting to enable the "personalized menus", does that setting apply to other application menus ?
Recently, in one of our application, one menu has a small menu item at the botton of the menu to expand and show hidden items, but there is no additional items to show!
What mechanism is used to control that behaviour ? is this a global Windows/Display setting or can this be enabled per application ?
I ask the question because now, using the Dundas bitmap menus, it crashed when selecting the "expand" menu item; before calling them, I want to learn a bit before.
Thanks.
|
|
|
|
|
Hey guys,
I don't see the difference in using two different ways of calling a function.
in the function send, you are creating a pair of set by calling the function creatNVPSet();
In the function update, you are creating a pair of set by first creating a pointer to a Ball object and then using the pointer pBall to call upon the member function createNVPSet();
What's the point of doing that? Can both of the function just create the set by using
createNVPSet(); instead of using pBall->creatNVPSet();
thanks in advance
PairSet* CreateNVPSet() {
............
............
return set;
}
void send (int x, int y) {
PairSet* pNvpSet = createNVPSet();
................
.............
}
void update (int a, int b) {
Ball *pBall;
PairSet* pNvpSet = pBall->createNVPSet();
...........
........
}
|
|
|
|
|
it's hard to say with the lack of details.
but this is wrong :
Ball *pBall;
PairSet* pNvpSet = pBall->createNVPSet();
you need to create a Ball object before calling createNVPSet on the object, it might simply be a simple omission in your exampel.
Also, you can have more than one method that create the same object, it depends on the design; in your example, does the send function a free function or is it a member of a class ? same thing for update ? maybe in the context of the update function there is no way to create a PairSet except thrue a Ball object.
|
|
|
|
|
sorry im missing some detail. The function createNVPSet is a member of class Ball.
PairSet* Ball::CreateNVPSet() {
............
............
return set;
}
|
|
|
|
|
It isn't calling the same function (at least not directly anyway).
Jay03 wrote: PairSet* CreateNVPSet() {
............
............
return set;
}
This function appears to be in the global namespace and is not a member of any class.
Jay03 wrote: pBall->createNVPSet();
This function is a member function of the class Ball. While it may end up calling the global method within that function, it is not the same function (and may not call the previous one at all ... depending on the implementation).
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
sorry im missing some detail. The function createNVPSet is a member of class Ball.
PairSet* Ball::CreateNVPSet() {
............
............
return set;
}
|
|
|
|
|
Is my initial argument correct now?
|
|
|
|
|
You haven't given enough information to tell, then. Are send and update both member functions as well? Show the whole class and the relevant methods' implementations and it will be easier to answer your question.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
RTI::AttributeHandleValuePairSet* Ball::createNVPSet()
{
RTI::AttributeHandleValuePairSet* pBallAttributes = NULL;
//! Make sure the RTI Ambassador is set.
if ( ms_rtiAmb ) // if ms_rtiAmb!=NULL
{
pBallAttributes = RTI::AttributeSetFactory::create( 4 );
pBallAttributes->add( Ball::ms_ballLocationXId,
(char*)&this->m_currentState.x,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballLocationYId,
(char*)&this->m_currentState.y,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballVelocityXId,
(char*)&this->m_currentState.vx,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballVelocityYId,
(char*)&this->m_currentState.vy,
sizeof(double) );
}
//! pClockAttributes is allocated on the heap and must be
//! deallocated by the calling function
return pBallAttributes;
}
void Ball::sendUpdate()
{
if ( m_nextStateCalculated == RTI::RTI_TRUE )
{
m_currentState = m_nextState;
m_nextStateCalculated = RTI::RTI_FALSE;
try
{
/*!
* In order to send the values of our attributes, we must
* construct an AttributeHandleValuePairSet (AHVPS) which
* is a set comprised of attribute handles, values, and
* the size of the values.
*/
RTI::AttributeHandleValuePairSet* pNvpSet = createNVPSet();
/*!
* Send the AHVPS to the federation.
*
* this call returns an event retraction handle but we
* don't support event retraction so no need to store it.
*/
(void) ms_rtiAmb->updateAttributeValues( getInstanceId(),
*pNvpSet,
NULL );
//! Must free the memory
pNvpSet->empty();
delete pNvpSet;
}
catch ( RTI::Exception& e )
{
cerr << "BALL: Error:" << &e << endl;
}
}
}
void Ball::update(
RTI::InteractionClassHandle theInteraction,
const RTI::ParameterHandleValuePairSet& theParameters )
{
if (ms_rtiAmb) // if ms_rtiAmb!=NULL
{
if ( theInteraction == Ball::ms_clockTickId )
{
RTI::ParameterHandle paramHandle;
RTI::ULong valueLength;
//! We need to iterate through the AttributeHandleValuePairSet
//! to extract each AttributeHandleValuePair. Based on the type
//! specified ( the value returned by getHandle() ) we need to
//! extract the data frlom the buffer that is returned by
//! getValue().
for ( unsigned int i = 0; i < theParameters.size(); i++ )
{
paramHandle = theParameters.getHandle( i );
if ( paramHandle == Ball::ms_clockTickIntervalId )
{
double timeInterval = 1 / 60.0;
theParameters.getValue( i, (char*)&timeInterval, valueLength );
//! Update all clock objects
for ( unsigned int j = 0; j < ms_numInstances; j++ )
{
( *( (Ball*)(ms_instances[j]) ) ).m_stateTimeInterval = timeInterval;
}
}
else if ( paramHandle == Ball::ms_clockTickNumId )
{
//! Don't care
}
else if ( paramHandle == Ball::ms_clockTickTimeId )
{
//! Don't care
}
else
{
//! There must be an error since there should only be
//! one parameter to Communication.
cerr << "BALL: Error: I seem to have received a parameter for "
<< "interaction class ClockTick that I don't "
<< "know about." << endl;
}
}
Ball* pBall;
for ( unsigned int k = 0; k < ms_numInstances; k++ )
{
cout << "BALL: Iterating through all Balls." << endl;
//! Get a pointer to the ball instance
pBall = (Ball*)ms_instances[ k ];
//! ** dequeue state from m_stateQueue and place it in m_currentState
if ( pBall->m_nextStateCalculated == RTI::RTI_TRUE )
{
pBall->m_currentState = pBall->m_nextState;
pBall->m_nextStateCalculated = RTI::RTI_FALSE;
try
{
/*!
* In order to send the values of our attributes, we must
* construct an AttributeHandleValuePairSet (AHVPS) which
* is a set comprised of attribute handles, values, and
* the size of the values. CreateNVPSet() is a method
* defined on the Ball class - it is not part of the RTI.
* Look inside the method to see how to construct an AHVPS
*/
cout << "BALL: Creating NVP set." << endl;
RTI::AttributeHandleValuePairSet* pNvpSet = pBall->createNVPSet();
/*!
* Send the AHVPS to the federation.
*
* this call returns an event retraction handle but we
* don't support event retraction so no need to store it.
*/
cout << "BALL: Sending new ball state out into the world." << endl;
(void) ms_rtiAmb->updateAttributeValues( pBall->getInstanceId(),
*pNvpSet,
NULL );
//! Must free the memory
pNvpSet->empty();
delete pNvpSet;
}
catch ( RTI::Exception& e )
{
cerr << "BALL: Error:" << &e << endl;
}
}
else
{
cerr << "BALL: Next state not ready." << endl;
}
}
}
else
{
cerr << "BALL: Recieved an interaction class I don't know about." << endl;
}
}
}
|
|
|
|
|
As Zac mentioned, show only the relevant code. All that extraneous code just gets in the way. Formatting your code with <pre> tags goes a long way, too.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
RTI::AttributeHandleValuePairSet* Ball::createNVPSet()
{
RTI::AttributeHandleValuePairSet* pBallAttributes = NULL;
if ( ms_rtiAmb )
{
pBallAttributes = RTI::AttributeSetFactory::create( 4 );
pBallAttributes->add( Ball::ms_ballLocationXId,
(char*)&this->m_currentState.x,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballLocationYId,
(char*)&this->m_currentState.y,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballVelocityXId,
(char*)&this->m_currentState.vx,
sizeof(double) );
pBallAttributes->add( Ball::ms_ballVelocityYId,
(char*)&this->m_currentState.vy,
sizeof(double) );
}
return pBallAttributes;
}
void Ball::sendUpdate()
{
if ( m_nextStateCalculated == RTI::RTI_TRUE )
{
m_currentState = m_nextState;
m_nextStateCalculated = RTI::RTI_FALSE;
try
{
RTI::AttributeHandleValuePairSet* pNvpSet = createNVPSet();
(void) ms_rtiAmb->updateAttributeValues( getInstanceId(),
*pNvpSet,
NULL );
pNvpSet->empty();
delete pNvpSet;
}
catch ( RTI::Exception& e )
{
cerr << "BALL: Error:" << &e << endl;
}
}
}
void Ball::update(
RTI::InteractionClassHandle theInteraction,
const RTI::ParameterHandleValuePairSet& theParameters )
{
if (ms_rtiAmb)
{
if ( theInteraction == Ball::ms_clockTickId )
{
RTI::ParameterHandle paramHandle;
RTI::ULong valueLength;
for ( unsigned int i = 0; i < theParameters.size(); i++ )
{
paramHandle = theParameters.getHandle( i );
if ( paramHandle == Ball::ms_clockTickIntervalId )
{
double timeInterval = 1 / 60.0;
theParameters.getValue( i, (char*)&timeInterval, valueLength );
for ( unsigned int j = 0; j < ms_numInstances; j++ )
{
( *( (Ball*)(ms_instances[j]) ) ).m_stateTimeInterval = timeInterval;
}
}
else if ( paramHandle == Ball::ms_clockTickNumId )
{
}
else if ( paramHandle == Ball::ms_clockTickTimeId )
{
}
else
{
cerr << "BALL: Error: I seem to have received a parameter for "
<< "interaction class ClockTick that I don't "
<< "know about." << endl;
}
}
Ball* pBall;
for ( unsigned int k = 0; k < ms_numInstances; k++ )
{
cout << "BALL: Iterating through all Balls." << endl;
pBall = (Ball*)ms_instances[ k ];
if ( pBall->m_nextStateCalculated == RTI::RTI_TRUE )
{
pBall->m_currentState = pBall->m_nextState;
pBall->m_nextStateCalculated = RTI::RTI_FALSE;
try
{
cout << "BALL: Creating NVP set." << endl;
RTI::AttributeHandleValuePairSet* pNvpSet = pBall->createNVPSet();
cout << "BALL: Sending new ball state out into the world." << endl;
(void) ms_rtiAmb->updateAttributeValues( pBall->getInstanceId(),
*pNvpSet,
NULL );
pNvpSet->empty();
delete pNvpSet;
}
catch ( RTI::Exception& e )
{
cerr << "BALL: Error:" << &e << endl;
}
}
else
{
cerr << "BALL: Next state not ready." << endl;
}
}
}
else
{
cerr << "BALL: Recieved an interaction class I don't know about." << endl;
}
}
}
|
|
|
|
|
|
it does actually...... does
take away the preprocessor statements
|
|
|
|
|
The call in the sendUpdate method is operating on only the current Ball object.
The call in the update method is operating on a Ball object that was contained in the array it is iterating through.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hey I need some help with trying to get a feature working.
What I have and what I'm trying to do:
I have a IE Toolbar derived from CCommandBarCtrlImpl (CCommandBarCtrlBase), this toolbar of course has several buttons and several of those buttons are of the dropdown type. On TBN_DROPDOWN the appropriate popupmenu is created as such
[code]
CMenu menuPopup;
menuPopup.CreatePopupMenu();
int items = 0;
for(unsigned int j=0;j<m_menu.m_items.size();j++)
{
="" if(m_menu.m_items[j]-="">shouldShow())
{
m_menu.m_items[j]->appendMenu(ctrl,(CMenuHandle)menuPopup,items,m_id);
items++;
}
}
m_globalReadyState=false;
DWORD dwThread=GetCurrentThreadId();
hSelectHook=SetWindowsHookEx(WH_CALLWNDPROC,SelectHook,NULL,dwThread);
hClickHook=SetWindowsHookEx(WH_MSGFILTER,ClickHook,NULL,dwThread);
ctrl->cur_btn=m_id;
::TrackPopupMenu(menuPopup, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, wnd, NULL);
UnhookWindowsHookEx(hSelectHook);
UnhookWindowsHookEx(hClickHook);
m_globalReadyState=true;
ctrl->m_popup.clear();
for(j=0;j<m_menu.m_items.size();j++)
{
="" if(m_menu.m_items[j]-="">shouldShow())
{
m_menu.m_items[j]->FreeMenu();
}
}
menuPopup.DestroyMenu();
[/code]
This works fine, but something I noticed is that whenever a popupmenu is open (weather it's one I make or just some random one in IE) then the toolbarbuttons won't receive any mouseinput (eg their mouseover effects stop functioning).
Right now Im handling mouseover so that whenever a user moves the mouse over a button with a dropdown button the Menu is forcefully shown (by emulating a send to TBN_DROPDOWN (OnDropDown)). What I want is for the toolbar to still receive mouseinput whilst a popupmenu is open so that you can for example move the mouse over a button with a popupmenu the popupmenu pops up, if you move the mouse to the next button whilst the popupmenu is open that next button still receives the mouseover aka "Hot" effect and it should also close the open popupmenu, this is especially important if the next button has a popupmenu to, then the old should close, and the one corresponding to the next button should open!
I'm really stressed about this because it's the only thing left to fix and I am a tad unknowledgable about MFC since this source was bought in from someone else and just handed to me to modify i feel like a fish on land. Hopefully someone might be able to swiftly rescue me =)
Thanks in advance! =)
|
|
|
|
|
How do I change the height of a programatically? I also want to change the size of the resizable frame of a Window. How do I go about doing it?
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
Do you need to customize titlebar from your application?
|
|
|
|
|
WhiteSky wrote: Do you need to customize titlebar from your application?
Yes!
---
Hakuna-Matada
It means no worries for the rest of your days...
It's our problem free, Philosophy
<marquee behavior="alternate" scrollamount="5" scrolldelay="50">
|
|
|
|
|
See here[^] maybe it is some helpful to you and Im not sure but i think an example in codeguru
|
|
|
|
|
Hi everybody, i'm trying to get an answer to my question: How to display a dialog in SDI app that has a class derrived from CRecordView?
But no one seems willing to tell me, or i'm trying smt impossible?
|
|
|
|
|
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
ivanris wrote: But no one seems willing to tell me, or i'm trying smt impossible?
Perhaps you are asking in the wrong place.
|
|
|
|
|
ivanris wrote: But no one seems willing to tell me, or i'm trying smt impossible?
This is very easy to do but I am not allowed to answer it here.
[EDIT]
Wait a minute wasn't this question in the lounge? If not I appologize.
[/EDIT]
John Last modified: Mon Aug 28 09:54:58 2006 --
|
|
|
|
|
you know john, some people can move threads around here... sorry, it was not a UFO
|
|
|
|
|
You've been answered more than once, with the most recent being a mere three minutes ago. See here and here. What exactly do you not understand?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|