|
but then how do I know which box was the one that was edited? where do I keep track of that?
|
|
|
|
|
these might come in handy:
#define GetMemberID() \
( (GetCurrentMessage()->wParam) & 0x0000ffff )
#define GetMemberWnd() \
( FromHandlePermanent( (HWND) (GetCurrentMessage()->lParam) ) )
(found em via Google)
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
|
|
I still haven't been able to figure out how this works. I can't assign a vector to the edit box because DDX_Control doesn't accept that.
Is there anything else you can suggest?
|
|
|
|
|
|
Here's the problem: I have 220 edit control boxes placed in a 10x22 matrix into which I have to individually insert numbers between -255 and 255. By editing the content of a box, I also know the address of the cell that was edited, and this is crucial. If I set up each box to go into the same subroutine (which is what I want), such as:
ON_EN_CHANGE(IDC_EDIT_Weights101, OnEnChangeEditWeights)
ON_EN_CHANGE(IDC_EDIT_Weights102, OnEnChangeEditWeights)
then in the OnEnChangeEditWeights subroutine, I also HAVE to be able to recognize which cell (101 or 102) was edited. What I wanted to do was to have a situation like this:
DDX_Control(pDX, IDC_EDIT_Weights101, weight[1]);
DDX_Control(pDX, IDC_EDIT_Weights102, weight[2]);
which is illegal because DDX control does not accept vectors. So how do I get the information about: 1) the box that was edited; 2) the value inserted, without having to create 220 individual subroutines, each with its own variable (weight1, weight2,...) that contains the address?
Let me know if this is clear enough.
|
|
|
|
|
francescot wrote: which is illegal because DDX control does not accept vectors
weight[x] is an int?
what about DDX_Text(pDX, IDC_EDIT_Weights101, weight[1]);
DDX_Control maps to a CWnd. but DDX_Text maps to int, float, CString, etc..
---
and, just FYI, if you can ensure that the IDs for the edit controls always fall into a fixed range, you can use the ON_CONTROL_RANGE[^] macro to handle the EN_CHANGE message. that will provide your handler the control ID - a little cleaner than using that macro i posted yesterday, but requires some diligence around the resource IDs.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I tried the first suggestion and here's what i got:
error C2665: 'DDX_Text' : none of the 17 overloads can convert parameter 3 from type 'HWND__'
am i doing something wrong?
i'll take a look at the on_control_range macro
|
|
|
|
|
francescot wrote: am i doing something wrong?
i assume width[] was a vector of ints. i guess it's a vector of HWNDs ?
use DDX_Text to put data into ints. use DDX_Control to associate CWnd-derived classes with resource IDs
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
I want to print currencys number so that it can be right justified like :
1250.55
00.60
100.00
what format to use ?
I learn my self
|
|
|
|
|
This is printed in a file or ? Please be more explicit.
If it is for a file, you can use fprintf and there are some parameters you can play on (for example the number of digits you want to see, the number of 'places' it will take, the alignment,...).
|
|
|
|
|
I want to print through a printer
|
|
|
|
|
like Cedric, i don't really understand your question.
as i understand your thought, it is a printing problem.
in this case, try this :
printf("%.2f", myFloatNumberToPrint);
TOXCCT >>> GEII power [toxcct][VisualCalc 2.20][VCalc 3.0 soon...]
|
|
|
|
|
With this your format, it is not worked.
When I write this format strCommand.Format("%.-2f",Amount), it is left justified, but how can I make right justified ?(strCommand is CString so to print with dc.TexTout instruction)
|
|
|
|
|
with this format strCommand.Format("%0.2f",Amount); there are many zero leading that I don't to see it.
What to do ?
|
|
|
|
|
Ig you want to justify it to the right, just add + in front:
mikobi wrote: strCommand.Format("%0.2f",Amount);
strCommand.Format("%+0.2f",Amount);
|
|
|
|
|
One way is to use a mono-spaced font.
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I understand well the source of my problem,
When I use default Font, the numbers are right align, If I create Font : like i do, numbers are not align.
This is how I create my Font
font.CreateFont(-80,0,0,0,FW_NORMAL,FALSE,FALSE,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH|FF_ROMAN,"Times New Roman");
What is mono chrome Font and How to create it
Urgent
|
|
|
|
|
Times New Roman is a proportionally-spaced font. That will not work. You must use a mono-spaced font like Courier.
Also, make sure the font variable does not go out of scope before the control itself does. You might want to make it a member of the control's parent (e.g., the dialog).
"The words of God are not like the oak leaf which dies and falls to the earth, but like the pine tree which stays green forever." - Native American Proverb
|
|
|
|
|
I am saying about mono spaced font and not mono chrome(it an error on my mind)
how to create it ?
I am waiting
I learn my self
|
|
|
|
|
Hi all,
How can I do to get Hex bytes from the keyboard. For example, I want to enter an address in hex like 0F3FFF05.
|
|
|
|
|
Where do you want to enter your address ? It must be limited to those hexadecimal char only ?
Try to be more explicit because if I had to give an answer to your question it would be: just press the keys you want...
|
|
|
|
|
The four bytes would be stored in a variable
unsigned char Address[3];
|
|
|
|
|
Hello,
If you want to store the string entered, than you would at least need 4 bytes more and 1 extra if you want a terminating NULL character.
Hexadecimal numbers (read bytes) are represented with 2 characters: 0x'F''F' for 255 for example.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|