|
Okay, so for a new xml tree, a dtd file is specified... parsed and validated. Structures containing the information for this tree are stored. Once this is done, a skeleton xml tree is generate, and when a user right clicks on a node, a menu pops up that displays options for that node; such as an insert option for any valid child element. When a user makes an insert selection from the menu, I need to know which selection he made so that I know which item to insert.
I guess I don't really need the text for the selection, but rather the index so that I can check my valid children list for the given node and insert correctly.
I figured out how to get the ID of the selected element... using the
m_SelMade = CMenu::TrackPopupMenu(TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RETURNCMD, point.x, point.y, this);
Now all I need to do is make sure to give each of the insert options a unique ID.
Thanks for the help.
-----------------
Genaro
\\\|
_ _
@ @
_\\
--|
_/
|
|
|
|
|
picazo wrote:
...when a user right clicks on a node...
In what type of control does this node exist?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
picazo wrote:
Now all I need to do is make sure to give each of the insert options a unique ID.
if you are filling the menu dynamically, and I assume that you know all the possibilities that the menu can contain; for example, for node X, you will put item a, b and c, and for node Z, you will put item a, b and d, ... for all node type. so you can manually add unique command ID in your resource.h file for each possible item.
Once that is done, use the return value from TrackPopupMenu, it will give you the ID that was selected because you used TPM_RETURNCMD .
then you can switch on those values ( or use a callback ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
i have generally heard adding WS_CLIPCHILDREN to a parent window reduces flicker and i couldve sworn it has worked for me like that in the past
but im writing an MFC application, it has a main frame tab control, and in the tabbable area i have a splitter with scrollable dialog views in it.
weirdest thing is, if the mainframe has WS_CLIPCHILDREN the Tab control flickers like crazy on resizing (mostly grey while sizing)
but without it it barely flickers at all (still flickers some)
(also i changed the behavoir for OnSize to not make the splitter fill the whole frame area, cause i think this was causing flicker also because i would just immediately resize the splitter back into the tab controls display area)
similarly i noticed that if my CSplitterWnds are created with WS_CLIPCLILDREN then whenever any part of the frame is resized ALL the child panes have TERRIBLE flickering
but when i take WS_CLIPCHILDREN back off of the splitters i have very minimal flickering (just like on the main tab control)
i dont understand why having WS_CLIPCHILDREN on Frames and Splitters would cause so much more terrible flicking for their child windows
|
|
|
|
|
When implementing my own non-dialog window class (e.g., something derived from CWnd), I typically add an OnEraseBkgnd() message handler, and change it to return TRUE (to indicate further erasing by the MFC framework is not needed). Sometimes, this helps me when trying to reduce flickering.
In your case, I think one of the root causes of flickering may be the use of the MFC tab control. I usually try to avoid it myself in any resizing situation (e.g., look for a custom tab control implementation). I don't know how hard it would be for you but you could test if this is the case by creating the contents of one of your tabs/panes within a dummy parent dialog or CWnd class instead. Add the similar OnSize() logic and see if you can reduce flickering on resize now that the tab control is out of the picture.
|
|
|
|
|
wxPoint point = GetPosition();<br />
HMENU pSysMenu = (HMENU )GetSystemMenu((HWND)this->GetHandle(), FALSE);<br />
if (pSysMenu != NULL)<br />
{<br />
int flag = TrackPopupMenu(pSysMenu, TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RETURNCMD, point.x+pt.x, point.y+pt.y, NULL, (HWND)this->GetHandle(), 0);<br />
if(flag > 0)<br />
SendMessage((HWND)this->GetHandle(), WM_SYSCOMMAND, flag, 0);<br />
}<br />
This wil display a system menu, but the problem is the system menu is not refreshed properly, whatever the previous one shown, when I click in the taskbar, is shown here also, and initally the maximize button is also enabled in the system menu shown by this way, whereas the maximize box is not in my frame. any idea....?
http://www.priyank.in/
|
|
|
|
|
I would like to accomplish the following:
If i pass my mouse over an edit box control on my application, i would like windows to display some text. Just like if you pass your mouse over a windows button, it describes the functionality etc.
Does anyone know how to do this?
|
|
|
|
|
|
Hmmmm!
How does the CToolTipClass work?
|
|
|
|
|
I would like to accomplish the following.
1. I would like some text in a record list to change color when i need to.
The text is "YES". I am inserting "YES" in the TEXT column using
SetItemText(i, TEXT, "YES") ;
Sometimes though, i would like to control the color. Like make it red
that that record has more importance. How would i accomplish this in MFC?
-- modified at 10:54 Friday 26th August, 2005
|
|
|
|
|
|
i'd like to get all ur advice for naming a Variable,Funtion, etc..etc..
for example,
how do you name a function like GET MACHINE STATE()
Is it nice to say like GetMachineState? or getMachineState() or getmachinestate() or GETMACHINESTATE()
AND FOR VARIABLES..
int eventCount; or EventCount; or eventcout;?
long C_value; or c_Value; or C_Value; ?
which one do u prefer? i've been messing up my program by not following a particular convention..
thanks ,
V
|
|
|
|
|
make ur convention and follow it up
|
|
|
|
|
whatz your way of naming them?
Thanks
V
|
|
|
|
|
Typically you would pick a convention that is comfortable and obvious to you, and use it consistently.
Vivekuniq wrote:
Is it nice to say like GetMachineState? or getMachineState() or getmachinestate() or GETMACHINESTATE()
In this case, I'd opt for the first one.
Vivekuniq wrote:
AND FOR VARIABLES..
int eventCount; or EventCount; or eventcout;?
I would use nEventCount .
Vivekuniq wrote:
long C_value; or c_Value; or C_Value; ?
I would use lValue although it does not describe what kind of value.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
My last C++ project used the following,
class CTestClass
{
private:
int m_classMember;
public:
int GetMachineState(int currentState)
{
int newState = currentState;
if(currentState != m_classMember)
newState = 12;
return newState;
}
};
Previous projects have used Hungarian Notation but with all my C# work, I've sort of gone off it.
Michael
CP Blog [^] Development Blog [^]
|
|
|
|
|
Michael P Butler wrote:
Previous projects have used Hungarian Notation but with all my C# work, I've sort of gone off it.
Your current style looks sort of Java-ish. Is this something that C# has advocated?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
sunit i quite right !
however, i could had this :
the most used is certainly the hungarian notation.
here is the main points to know about it.
a letter can prefix the name of a variable to show its type :
i or n integer
f float
d double
l long
c character
b boolean
dw double word
w word
by or byte byte
sz C-style null-terminated string
str C++ string object
h handle
v vector
pt point
rgb RGB triplet
p pointer to
r reference to
u unsigned
a or ary array of
m_ member variable
g_ global variable
s_ static variable
the name of an identifier must be the most explicit as possible.
you can find different styles, such as getMachineState(), GetMachineState(), get_machine_state(), etc...
upper case identifiers are in general for constants...
to this, there are also some specific rules, but the most important is that you should select your own, and follow them !
TOXCCT >>> GEII power [toxcct][VisualCalc]
-- modified at 11:11 Friday 26th August, 2005
|
|
|
|
|
We use CamelCase for function and variable naming although variables always start in lower case while functions start in uppercase:
m_myVariable
MyFunction();
When you know the rule, you can tell at a glance whether its a function or a variable.
If you vote me down, my score will only get lower
|
|
|
|
|
got nice tips from u all..i think i need to change my style a lot.. thank u guys
thanx
V
|
|
|
|
|
How can I know that which Lan users are accessing the folders which I have shared?
|
|
|
|
|
Use NetShareEnum().
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I was freaked out with this code until went to disassembly
Find what you need to fix problem?
#include "stdafx.h"
class CA
{
public:
// do not add default constructor here
// solve problem with out it
CA(int nA)
{
m_nA = nA;
}
int m_nA;
};
class CB : virtual public CA
{
public:
CB(int nB) : CA(nB)
{
m_nB = nB;
}
int m_nB;
};
class CC : virtual public CA
{
public:
CC(int nC) : CA(nC)
{
m_nC = nC;
}
int m_nC;
};
class CD : public CC, public CB
{
public:
CD(int nD) : CC(nD), CB(nD)
{
m_nD = nD;
}
int m_nD;
};
int _tmain(int argc, _TCHAR* argv[])
{
CD oD(1);
//error C2512: 'CA::CA' : no appropriate default constructor available
return 0;
}
//funny ha?
-- modified at 10:21 Friday 26th August, 2005
|
|
|
|
|
Aha! This is obviously the classic "Diamond-of-Death" inheritance problem in the code. If you have this in your code, then you seriously need to rethink!
Joel Holdsworth
-- modified at 10:43 Friday 26th August, 2005
|
|
|
|
|
u should provide default contructor if you define argument contructor
|
|
|
|