|
I'm not sure exactly what you are after here but converting text to double, as the subject implies, is as simple as the code snippet I provided earlier. The other code you have is definitely not necessary. You appear to be doing:
text --> double --> text
Is there a point to this exercise? If you are simply wanting to show in a message box what was typed, two lines of code will suffice:
GetDlgItemText(IDC_EDITBOX, txtEdit);
AfxMessageBox("Value is " + txtEdit); If you need the value for calculation reasons, just call atof(txtEdit) .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Ah...again is it just me or, why don't you just set your edit box to value and float. That way you won't have to convert anything.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
That's right but if I do that I'd have to write my function as many times as I have Edit boxes with just the name of the float variable changing.
I'd like to do something more generic. It would all work fine if I could convert a string to a float!
Thanks for the help though!
|
|
|
|
|
How do I find out if a Dialog box is open?
I am trying to do a popup dialog box. When user holds down R mouse button a dialog appear and will disappear when R mouse button is release.
I am able to invoke the dialog but I am having problem terminating the dialog
|
|
|
|
|
Anonymous wrote:
I am able to invoke the dialog but I am having problem terminating the dialog
Is it modal or modeless?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
By definition, a modal dialog box remains active until it has been dismissed. This would keep the window that owns the dialog (i.e., parent) from seeing the right mouse button.
Perhaps if you provided a bit more information as to what you are doing, an alternative solution could be offered.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Ahh that's why it wouldn't close it when I tried EndDialog.
Currently I am using Scrollview, I have a bunch of object draw on the screen. When user right click on the object it would pop up a dialog with information about the object, but would disappear once the mouse button is released.
Should I be doing it as modaless?
|
|
|
|
|
poiut wrote:
Should I be doing it as modaless?
I would lean in that direction.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Yes at least make it modelss, but even better would be a pop up window that is NOT a dialog at all.
It can still be a child of the parent window, but it would not attempt to capture messages and events like a dialog would.
|
|
|
|
|
Can you point me in the right direction?
Any article/example or function on it?
Thanks
Currently I am reading
http://www.codeproject.com/dialog/csettingsdlg.asp
on Modaless
|
|
|
|
|
Derive an MFC class (assuming that is what you are using) from CWnd and add handlers for it to display your information.
Then call Create() to create the window where ever you need it to show up on screen.
You can 'hide' and 'show' it as necessary, send it updated text, and MoveWindow it as the user moves his mouse around to select different items.
Before your main window ends, you should delete the window you created.
|
|
|
|
|
Thanks David & Blake.
I got modlass working
|
|
|
|
|
|
Hi,
Iam using ToolBarControl & in my "ToolTipsHandler" which is an event declared in the message map as follows
BEGIN_MESSAGE_MAP(C_ListPageTemp, CDialog)
//{{AFX_MSG_MAP(C_ListPageTemp)
ON_NOTIFY_EX(TTN_NEEDTEXTA,0,ToolTipsHandler)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
Now my "ToolTipsHandler" function goes like this
*****************************************
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
pTTT->lpszText = MAKEINTRESOURCE(nID);
pTTT->hinst = AfxGetResourceHandle();
return TRUE;
*********************************************
Now instead of taking the tooltiptext from the ResourceStringtable,I want to provide my own strings(decided upon,on which language the tooltip text should appear.This language string, I will be getting from a part of my program which Iam not showing here.)
Will be getting this language dependent string in "T_String" type where "T_String" is of type
typedef std::wstring T_String;
I tried to provide my string as follows.
T_String test;//(string which I get from a part of my Program ,depending on language).
pTTT->lpszText =const_cast<lptstr>(test).
It compiled,but the tooltip displayed was a junk value.
Is this(pTTT->lpszText),the right place to give my string in the "TOOLTIPTEXT" structure or should I use the "szText" member.
If so,How would I make the necessary conversions.
Would be nice if someone could tell me with a code snippet..
Thanks..
|
|
|
|
|
FROM MSDN:
In writing your tool tip notification handler, you need to use the TOOLTIPTEXT structure. The members of the TOOLTIPTEXT structure are:
typedef struct {
NMHDR hdr; // required for all WM_NOTIFY messages
LPTSTR lpszText; // see below
WCHAR szText[80]; // buffer for tool tip text
HINSTANCE hinst; // see below
UINT uflags; // flag indicating how to interpret the
// idFrom member of the NMHDR structure
// that is included in the structure
} TOOLTIPTEXT, FAR *LPTOOLTIPTEXT;
hdr
Identifies the tool that needs text. The only member of this structure you might need is the control's command ID. The control's command ID will be in the idFrom member of the NMHDR structure, accessed with the syntax hdr.idFrom. See NMHDR for a discussion of members of the NMHDR structure.
lpszText
Address of a string to receive the text for a tool.
szText
Buffer that receives the tool tip text. An application can copy the text to this buffer as an alternative to specifying a string address.
hinst
Handle of the instance that contains a string resource to be used as the tool tip text. If lpszText is the address of the tool tip text, this member is NULL.
When you handle the TTN_NEEDTEXT notification message, specify the string to be displayed in one of the following ways:
Copy the text to the buffer specified by the szText member.
Copy the address of the buffer that contains the text to the lpszText member.
Copy the identifier of a string resource to the lpszText member, and copy the handle of the instance that contains the resource to the hinst member
I think you can try using szText. Remember it can only hold 80 characters, which is not much.
good luck.
(let me now if it worked? tnx)
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
I'm trying to write a generic function that reads and writes a float to any Edit box when its spinner is activated. I can get the Edit box associated with the spinner by using GetBuddy() . Once I now which Editbox I'm dealing with, how can I get the float variable, the control variable or the identifier of that edit box?
Ideally I would really want to directly access the float variable associated to that Edit box so I can modify it without having to do string2float conversion.
I hope I make sense here...
Anyway, any help would be most appreciated.
Cheers!
Pat.
|
|
|
|
|
Zeroed In wrote:
Ideally I would really want to directly access the float variable associated to that Edit box so I can modify it without having to do string2float conversion
CEdits do not know anything about floats or doubles or integers . They only know about text.
Any variable that is 'associated' with a text box is only associated by the fact that both it and the CEdit are parameters in a DDX* function call - other than that, there is no association. The CEdit itself doesn't know anything about the float you've associated with it.
Image Toolkits | Image Processing | Cleek
|
|
|
|
|
You can get a control's ID value by calling GetDlgCtrlID()[^]
As mentioned by Chris Losinger, you can't tag a float along with the CEdit control unless you derive your own version, CFloatEdit for example. But you'll still have to do the text-to-string (and vice versa) conversions and validations on your own. Sorry
The bright side is that it's all eminently doable
Bob Ciora
|
|
|
|
|
please help me in understanding, how does a windowes taskmanager works? how does it comes to know of a currently running application? how can i make a running application hidden from it.
|
|
|
|
|
I've never had the desire to duplicate what TM does, but I would hazard a guess that it uses Process32First() and Process32Next() . If not, it does use NtQuerySystemInformation() .
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
If you parent your main window off another desktop created on another window station, most logged in users will never know your app is there. See CreateDesktop and CreateWindowStation.
|
|
|
|
|
I need to use the method Update() in order to modify fileds values.
In VB are not problem, but in VC++ how can I use it?
Can help me with any example?
Thanks a lot
Xavier
|
|
|
|
|
|
Yes, of course. I needed in Visual C++, no VB++
Thanks in advance
Xavier
|
|
|
|