|
Thanks for your response.
That macro allows me to add an OnUpdateCommandUI handler which gets called right after the button is clicked.
But how does it allow me to do something like ribbonButton.Enabled(FALSE); NOT in response to a button click?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I guess it's just a matter of creating a function that can enable or disable the button, something like:
void EnableButton(CMFCRibbonButton& ribbonButton, bool bEnable)
{
ribbonButton.Enable(bEnable);
}
or better still, a function that enables/disables all the buttons based on a set of rules ...
void EnableButtons(int nRule, bool bEnable)
{
switch (rule)
{
case 1:
ribbonButton1.Enable(bEnable);
ribbonButton2.Enable(bEnable);
break;
case 2:
ribbonButton1.Enable(bEnable);
ribbonButton6.Enable(bEnable);
ribbonButton7.Enable(bEnable);
break;
}
}
You then call this function from elsewhere in response to some arbitrary decision of your own.
|
|
|
|
|
Now you've hit upon the exact problem: The CMFCRibbonButton does not have an "Enable" method, or any method like it, hence my dilemma.
Thanks again for your time.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
|
I hear what you're saying, but that IsDisabled() property is read-only. And the SO question you link to says basically what we already know about the MFC macros.
That's why I can't figure this out.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Sorry nor can I. But given what I said about Word and the SO question, it must be possible. Unfortunately it is too many years since I used MFC in anger so I can't even try a few things. I wonder where all the CodeProject MFC experts are?
|
|
|
|
|
/*
TEST WITH THE FOLLOWING
PROBLEM 1
inputs:
infinity:999
no. of cities: 4
no. of paths:6
PROBLEM 2
inputs:
infinity:999
no. of cities: 5
no. of paths:10
*/
#include <stdio.h>
#define ALL -1
#define MAXCITIES 10
enum BOOL{FALSE,TRUE};
long*visited;//visited nodes set here
long*min_circuit;//min inner circuit for given node as start node at position indexed 0
long*ham_circuit;//optimal circuit with length stored at position indexed 0
long min_circuit_length;//min circuit lenth for given start node
int n;//city count
long matrix[MAXCITIES][MAXCITIES];//nondirectional nXn symmetric matrix
//to store path distances as sourceXdestination
long INFI;// INFINITY value to be defined by user
// function resets minimum circuit for a given start node
//with setting its id at index 0 and setting furthr node ids to -1
void reset_min_circuit(int s_v_id)
{
min_circuit[0]=s_v_id;
for(int i=1;i<n;i++) min_circuit[i]="-1;
}
//" marks="" given="" node="" id="" with="" flag
="" if="" it="" all="" nodes="" flag
void="" set_visited(int="" v_id,bool="" flag)
{
="" if(v_id="=ALL)" for(int="" i="0;i<n;i++)" visited[i]="flag;
" else="" visited[v_id]="flag;
}
//" function="" sets="" hamiltonion="" circuit="" for="" a="" path="" length
="" setting="" at="" index="" 0="" and="" furthr="" from="" current="" min_circuit
void="" set_ham_ckt(long="" pl)
{
="" ham_circuit[0]="pl;
" ham_circuit[i+1]="min_circuit[i];
" ham_circuit[n+1]="min_circuit[0];
}
//function" valid="" by="" finiding="" min="" inner="" given
="" combination="" start="" vertex="" next="" to="" such="" that
="" the="" 2nd="" of="" circuits="" is="" always="" s_n_v="" dest="" is
="" s_v="" possible="" values="" s_n_v,="" then="" returns="" the
="" length="" this="" combination
long="" get_valid_circuit(int="" s_v,int="" s_n_v)
{
="" int="" next_v,min,v_count="1;
" long="" path_length="0;
" min_circuit[0]="s_v;
" min_circuit[1]="s_n_v;
" set_visited(s_n_v,true);
="" path_length+="matrix[s_v][s_n_v];
" v="s_n_v;v_count<n-1;v_count++)
" {="" if(="" matrix[v][i]<infi="" &&="" !visited[i]
="" matrix[v][i]<="min
" )
="" set_visited(next_v,true);
="" }
="" return(path_length);
}
int="" main()
{
=""
="" printf("make="" sure="" that="" infinity="" value="" <="" sum="" distances\nset="" (signed="" long):");
="" scanf("%ld",&infi);
="" pathcount,i,j,source,dest;
="" dist="0;
" new_circuit_length="INFI;
" printf("enter="" no.="" cities(max:%d):",maxcities);
="" scanf("%d",&n);
="" count:");
="" scanf("%d",&pathcount);
="" paths:<="" source_id="" destination_id="" distance="">\n ids varying from 0 to %d\n",n-1);
//init all matrix distances to infinity
for(i=0;i<n;i++)
for(j="0;j<n;j++)
" matrix[i][j]="INFI;
//populate" the="" matrix
=""
="" for(i="0;i<pathcount;i++)
" return="" 0;
="" {
="" printf("[path="" %d]:",i);
="" scanf("%d="" %d="" %ld",&source,&dest,&dist);
="" if(source!="dest)
" matrix[source][dest]="matrix[dest][source]=dist;
" }
="" visited="new" long[n];
="" min_circuit="new" ham_circuit="new" long[n+2];
="" min_circuit_length="INFI;
" algorithm
="" for="" each="" vertex,="" s_v="" as="" a="" staring="" node
="" for(int="" s_v_id="0;S_V_id<n;S_V_id++)
" {="" and="" non="" start="" vertex="" i
="" set="" all="" to="" unvisited
="" set_visited(all,false);
="" visited
="" set_visited(s_v_id,true);
="" reset="" init="" minimum="" circuit
="" reset_min_circuit(s_v_id);
="" obtain="" circuit="" combination="" of="" new_circuit_length="get_valid_circuit(S_V_id,i);
" if="" newer="" length="" is="" less="" than="" previously
="" calculated="" min="" then="" it="" the
="" current="" in="" hamiltonion="" if(new_circuit_length<="min_circuit_length)
" set_ham_ckt(min_circuit_length="new_circuit_length);
" }
="" any="" found
if(min_circuit_length<infi)
{
="" printf("\n\nminimum="" is:="" %ld\ncircuit="" is:\n",min_circuit_length);
="" printf("<%ld=""> ",ham_circuit[i]);
}
else printf("\n\nNo hamiltonian circuit !");
delete []visited;
delete []min_circuit;
delete []ham_circuit;
}
|
|
|
|
|
What is your question?
Note: I have deleted your duplicate of this post.
|
|
|
|
|
HI ALL,
I was working building Visual C++ software using Visual Studio 6.
Now I have Visual Studio 2008 and still have this C++ project.
if I want to rebuild it on Visual Studio 2008, what are the attentions I shall pay?
diligent hands rule....
|
|
|
|
|
Add the project, build it, and see what happens.
|
|
|
|
|
good point. based on my research, it shall be the same because Visual Studio 2013 can still build native C++ image.
diligent hands rule....
|
|
|
|
|
Southmountain wrote: based on my research What research? All versions of Visual Studio build C++ code into a native image.
|
|
|
|
|
What research? All versions of Visual Studio build C++ code into a native image.
While true, some versions produce horribly bloated images (ref. the .... was it CDialog library bug in one or two versions of MFC) making them quite unsuitable to use, or produce images impossible to run on anything but the "Latest And Greatest(tm)" Microsoft Operating System.
It does require research to find out about such things.
|
|
|
|
|
From my unfortunate experience ( both with VS or VB ) - the challenge is OS and its "references" to "new" VS versions.
In my cases my "old" VS 6 code was either automatically or semi-outomatically ( Do you want to convert it?) converted to LATEST VS on PC.
It is a "one way" conversion, no returns.
|
|
|
|
|
As has been said, moving up the chain of compilers is easier than moving down them.
I strongly suggest creating a brand new solution with VS 2008 and the copying the source files into the structure and adding them.
Migration projects/solutions from Visual Studio 1.52 up to Visual Studio 2010 have all sorts of problems, which only get worse with each conversion. These issues have largely been eliminated in 2010-2013 (though there are some edge cases that are problematic.)
|
|
|
|
|
Does anyone know how c language is used to make a software. Normally we run small c programs in a compiler but what is actualy done in making a software ........
|
|
|
|
|
What do you mean by "making a software "?
The normal process, is that the compiler converts C language into object modules, and the linker combines object modules and libraries to create an executable program. Google will find you more detailed explanations it you need them.
|
|
|
|
|
I also want to know project in vending machine .I have a project. Some one help for this
|
|
|
|
|
|
Please read this[^].
"the debugger doesn't tell me anything because this code compiles just fine" - random QA comment
"Facebook is where you tell lies to your friends. Twitter is where you tell the truth to strangers." - chriselst
|
|
|
|
|
I also want to know project in vending machine .I have a project. Some one help for this
|
|
|
|
|
I create dynamically a CMenu inside a CDialog that have some acceleration keys ie
m_pBCMenu->AppendMenu(MF_STRING, ID_MENU_STRETCH_NORMAL, _T("&Size\tAlt+1"));
The same menu, is also created inside in CMainFrm that all command events (even from the CDialog) are routed and handled in there.
The problem is that the acceleration keys in my CDialog are not shown, ie Alt+1 is hidden but the commands are routed just fine.
How can I force to view the acceleration keys inside the CDialog's CMenu ? Note, that I used the LoadAccelerators function successfully on my onInitDialog and I also tried to use ON_COMMAND(xxx,xxxx) in my CDialog without any success.
Any recommendations ?
sdancer75
|
|
|
|
|
|
Hi,
I don't mean the underline char accelerators but the keyboard shortcuts ie Ctrl-F1 that are loaded with LoadAccel(). I already read the article you pointed to me, but does not fit in my case.
Regards,
sdancer75
|
|
|
|
|
Can any body help me with C code to solve these two problems since i am not so familiar with C language..Thank you very much.
1.f(N) be the number of points with integer coordinates that are on a circle passing through (0,0), (N,0),(0,N), and (N,N). Figure out f(10000)=? Print out these points.
2.The number 145 is called a curious number,as 1! + 4! + 5! = 1 + 24 + 120 = 145. Find all curious numbers blow 10000 which are equal to the sum of the factorial of their digits. Print out them.
|
|
|
|