|
thx for the help. it's been really useful. i'm a step closer to the solution but theres still an issue:
the actual matter about the generic list is that, in this program, the user gets to decide what "fields" of a database get on the list. so for each user, or even for the same user changing the configuration, I get a different kind of list.
so I gotta work on some kind of generic way to use those list, otherwise the number of field combinations are virtually infinite!
another thing...I haven't been able to figure out a way to apply the n-criteria sorting, the numeric-alphanumeric thing is easy, but first of all I don't know WHICH or HOW MANY fields I have, and also it gets confusing how to apply the sorting in a generic way...
this problem looks pretty complex...hope someone gets it right! thx in advance!!
|
|
|
|
|
Mariano Lopez-Gappa wrote: the user gets to decide what "fields" of a database get on the list.
This is probably a silly question but why not use the database to do the sorting for you? I do this all the time. I create a query based on what fields the user wants. Too slow or possibly you are making your own database??
John
|
|
|
|
|
I'm not going to use MFC, nor any database as I need my program to work on a 486 dx2. Also the purpose of the list is to display multisorted information on a grid.
Thx anyway! keep talking ppl plz!
|
|
|
|
|
Hi,
I think that each "certain data type" must have a common base class,
which could be as simple as
class CBase {
... Constructor/Destructor...
UINT m_type;
// The class type.
UINT GetType () { return m_type; };
};
Suppose you had various other classes CA, CB, CC, CD derived from CBase
Then the comparison routine for the sort could switch in the following way
int Compare( const void *e1, const void *e2 )
{
// handle element e1
switch ( ((CBase *)e1)->GetType() ) {
case TYPEA:
CA *A = (CA *)e1;
--- set some criteria based on CA info ---
break;
case ...
etc.
// handle element e2
switch ( ((CBase *)e2)->GetType() ) {
case TYPEA:
CA *A = (CA *)e1;
--- set some criteria based on CA info ---
break;
case ...
etc.
// Now make the comparison based on information generated in the
// last 2 steps.
--- comparison code ---
}
Id be interested to hear if anybody can think of a more general/elegant way to do it!
Cheers,
Dave
|
|
|
|
|
Hi
Bare with me for this question for its not VC++...but since my app is in win32 I am posting this question here.
I have a circle , say center cx,cy and radius R. At any point the user clicks either inside or outside the cirle ( but not too much far away from the circle). Say that point is ux,uy.
Now I have find the point on circle(say x,y)relative to ux,uy. ie,
I can imagine a line L starting from center to ux,uy, and the point where line L and circle meets is x,y. I ux,uy is inside the circle I have to extend the line L to meet the circle. How do I find x,y at any time.
I could'nt include the diagram here. so I am trying to clear as much as I can.
Thanks in advance.
|
|
|
|
|
you have to make a system with 2 equations.
one with the circle equation :
E1: ax²+by²=r²
where r is the radius (not sure about the word in english - it is diameter/2)
another with the line equation
E2: ax + by + c = 0
then solve the problem. you will have 2 solutions (as the line always goes through the center of the circle). to choose which is the right one, you'll have to compare the coordinates of the center, with the coordinates of the mouse click.
if ux > cx then
Solution is then one with x > cx
else if ux < cx then
Solution is the one with x < cx
else
if yx < cy then
Solution is the one with y < cy
else if yx > cy then
Solution is the one with y > cy
else
No Solution
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
My trig is rusty, but I think this will get you there.
Given the origin of your circle is at (Ox,Oy) and your mouse click is at (Mx, My) then your x,y pair for your circle is
X=Mx - Ox
Y=My - Oy
The angle between the line create by that point and the X axis would be
A = atan2(Y,X).
Now you want the point on your circle (Cx, Cy)
Cy = r * sin(A) + Oy
Cx = r * cos(A) + Ox
|
|
|
|
|
That worked...coooolll.
BIG THANKS...
|
|
|
|
|
I have this datagrid with I am binding with data set ... I am not using all the columns from table I am bounding with 5 columns only ... How do i increase the length of coulmns in datagrid ... so it looks good on page .. currrunly i have 5 columns in data grid .. all on left side ... data does wrap ..
Thanks
|
|
|
|
|
|
DataGrid1.DataSource = tempDs.Tables["Personnel"].DefaultView ;
I am setting columns in Property builder which doesn't have property to set width ... How do I do it?
Thanks
|
|
|
|
|
DataGrid1.Columns[0].ItemStyle.Width = 100;
DataGrid1.Columns[1].ItemStyle.Width = 300;
doesn't work
Thanks
|
|
|
|
|
Hello,
I have an MFC application with various standard MFC controls that display Japanese characters correctly. This application is also hosting an ActiveX control that dynamically creates and owns its own MFC controls. For some reason some of the MFC controls in the ActiveX control don't display the multibyte charachters correctly. These controls appear to be treating the multibyte strings as single byte strings.
Any thoughts on what might be causing this and how I can fix it? It appears that it's the dynamically created controls only that are having this problem.
Thanks!
-Ian
|
|
|
|
|
Ian Bowler wrote: It appears that it's the dynamically created controls only that are having this problem.
How are you setting the text to these dynamically created controls?
-prakash
Learning Symbian | Personal views
|
|
|
|
|
The same way I'm setting the text for the static controls: SetWindowText.
I moved one of the dynamically created controls into a CDialog. When I launch the CDialog from my ActiveX control, I can see that the text is being displayed just fine. The only difference now between the two controls (as near as I can tell), is the working control is a child of a CDialog and The failing control is a child of a basic CWnd.
|
|
|
|
|
Did you ensure that the ActiveX project has UNICODE defined?
Does the controls in the activeX shows properly if the text is english?
Can you actually show the code from fetching the string to SetWindowText?
-prakash
Learning Symbian | Personal views
|
|
|
|
|
Hello.
This is my first post here, so I just want to say I am happy to take part in this great community.
I have read here one of the articles about crashReport.
So I am required to use __try/__except:
__try<br />
{<br />
Result = HandledMain(argc, argv);<br />
}<br />
__except(RecordExceptionInfo(GetExceptionInformation(), "main thread"))<br />
The problem is that my program already use exception in the "traditional" way, i.e.: try{}catch(){}
How can I translate my already existing exception handling?
Or is there a way to get the PEXCEPTION_POINTERS information with the "traditional" try/catch?
Thanks in advance.
|
|
|
|
|
did you tried something like this ?
#define try __try
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I have managed.
Eventually I didnt need __try.
I used se_translator to convert C exceptions into C++ exceptions.
|
|
|
|
|
I am curious what people use to secure the shared memory that is commonly used as an IPC mechanism between two processes. Any thougts and prototypes?
thanks!
|
|
|
|
|
Lambu Jindu wrote: I am curious what people use to secure the shared memory that is commonly used as an IPC mechanism between two processes. Any thougts and prototypes?
For Securing People Generally use Encrypted text for sending data! or SSL ( with sockets)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I've created an application with runs as a plugin for Microstation.
My application is a DLL whose functions are called by Microstation in a specific lanaguage.
if my function launch a dialog box like this
definition:
extern "C" __declspec(dllexport) BOOL fooSystem_showAboutBox();
implementation:
BOOL fooSystem_showAboutBox()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
try
{
theApp.showAboutBox();
}
catch(...)
{
return FALSE;
}
return TRUE;
}
//in foo.cpp
void CFooApp::showAboutBox()
{
CAboutDialog dlgAbout;
dlgAbout.DoModal();
}
then, the "about" dialog is not able to intercept any messages like WM_TIMER, and the function PreTranslateMessage is never reached. This problem is also valid for theApp.
There isn't any other classes which may intercept messages before my function (maybe except one from MFC hierarchy) or implementing the virtual function PreTranslateMessage.
I really don't understand this.
Have you any idea about this issue ?
Thanks.
Firejano
-- modified at 11:42 Thursday 27th October, 2005
|
|
|
|
|
Is there a hash string function that preserves the capability to compare two strings just by comparing their respective hash values ?
Currently, I have to perform a full Str.Compare("other string") in order to sort them. I had also calculated their hash value, but the sorting (Quick Sort, Bubble Sort, whatever...) fails using the hash value. The hash value is mostly random, especially on long strings.
Comparing the hash values (int) would have been quite faster, I have to perform the quickest sort possible on text files larger than 100 MB ! So please don't come with CString as a solution. It works, but asks hours to do the job. CString is perfect to manipulate UI strings, but bad for heavy duty purposes...
So, to sum up, it there a good hash function that will allow :
"Minus string" < "Plus string"
HASH("Minus string") < HASH("Plus string")
Kochise
In Code we trust !
|
|
|
|
|
Kochise wrote: it there a good hash function that will allow ...
my gut reaction is No. the amount of information required to accurately compare two strings is all of the information in each string. but hashes for arbitrary input grind the information in the source data down into a package that's large enough that two different input strings will have a small (but still non-zero) chance of generating the same hash, but small enough to be passed around and used quickly.
but if you have less data than you started with and the possibilty that two source values will produce the same hash, then there's no way to go from the hash back to the source value, and so there's no way to guarantee an accurate sort using just the hash.
that's not to say hash values can't play a role in sorting, of course (they do, and there's a lot of info in Google about this very large topic), just that you can't generate a small numeric reversible hash for arbitrary character strings.
Cleek | Image Toolkits | Thumbnail maker
-- modified at 16:29 Thursday 27th October, 2005
|
|
|
|
|
Nadanada, I'm not willing to 'compress' a string in an integer, and restore the string from the integer afterward. What I just want is to help my sorting routines by feeding it with fixed size integer the CPU could handle very easily, not variable length strings...
Currently, I'm feeding a custom string tree. All strings are stacked as-is, and I used the HASH value as node's key. Even if they are mostly 'random', strings are inserted 'as-is' from their hash value. It works. I can even search for a particular string, it's hash value is found in the tree.
The problem occurs when I'm trying to sort the tree, or at least walk it in a ascendant or descendant way. What I get is hash values from the minus one to the maximum one. But their corresponding string is non-sense, they don't follow the ascending or descending order I'm trying to get.
Yeap, I found some pages on Google about hash functions :
http://www.partow.net/programming/hashfunctions/
http://www.isthe.com/chongo/tech/comp/fnv/
http://www.cs.rice.edu/~scrosby/hash/
But none helped me in what I was trying to get. I can accept a little level of collision, because I know and control the input. And even if I get the same hash match, I can always control the two strings with a good old compare. At least I saved the whole tree walking which was processed in hash integer comparaison.
So thanks at least to having helped me to loose focus on the 'hash trick', as this won't evolve in a success. I will try another method to sort out my strings using an integer.
Kochise
In Code we trust !
-- modified at 3:18 Friday 28th October, 2005
|
|
|
|