|
parichaybp wrote: I have created a List Control. I have to add the text by default by which the user can modify the text as required.
I've no idea what you are trying to say here.
parichaybp wrote: I have to add the folowing text by default when the Dialog window loads.
What do you mean "by default?" What control do you want this text added to? If it's a list control, please explain in more detail as that control can be displayed in many different formats (e.g., report, list, icon).
parichaybp wrote: Can anyone please tell me how to add the default text to the list box
Now you are using a listbox?
parichaybp wrote: ...also user can edit the text and also remove the text..
Do you need an edit control for this?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Hey folks:
I've got a nice C++ STL string and I need to turn it into a TCHAR.... (and I can't use MFC)
I've tried:
typedef std::basic_string< TCHAR > tstring;
and it doesn't work (or it does, and I don't know how to use it) ... basically how do I convert these types?
Thanks!
-- modified at 2:07 Monday 17th April, 2006
|
|
|
|
|
typedef std::basic_string< TCHAR > tstring;
is the correct syntax for changing a STL string to TCHAR
Now when you want to change the string to tstring you can use
tstring("ABCXYZ"); that's all
I hope this works fine at your end but there may be some other problem in the way you are using this code.Please specify how you are using the code.
Vision is Always important and so is your ATTITUDE.
Wishes.
Anshuman Dandekar
|
|
|
|
|
So I have the following header, but basically, I have a STL string that I want to convert to tchar, to call Win32 APIs... (that require the use of LPTCSTRs) when I try your suggestion:
tstring blah = tstring("ABCXYZ");
I get the error:
error C2440: '<function-style-cast>' : cannot convert from 'const char [7]' to 'tstring'
Could you provide a more elaborate example? Thanks!
#include <windows.h>
#include <stdio.h>
#define NULL 0
#include "LogFiles.h"
#include "TestPrint.h"
#include <string>
#include <iostream>
#include <conio.h>
using namespace std;
typedef std::basic_string< TCHAR > tstring;
|
|
|
|
|
Lots of helper functions here[^] (look for toWideString()).
0 bottles of beer on the wall, 0 bottles of beer, you take 1 down, pass it around, 4294967295 bottles of beer on the wall.
Awasu 2.2 [^]: A free RSS/Atom feed reader with support for Code Project.
|
|
|
|
|
i am making a application as follows:
there is one main dialog and then i am calling a component that is also dialog and i want to set the position of componet dialog to main dialog.
now i have successfully set the button which are actually creating in component and set at main dialog but i want to whole dialog to main dialog
can anybody tell me what i have to do for the same.
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Bankey Khandelwal wrote: now i have successfully set the button which are actually creating in component and set at main dialog but i want to whole dialog to main dialog
Huh?
Gavin Taylor
w: http://www.gavspace.com
|
|
|
|
|
Hi Bankey Khandelwal
You want to set position from dialog?
|
|
|
|
|
now its done
thank you
Bankey Khandelwal
Software Engineer
|
|
|
|
|
Hi
I have problem related to singelton class....
I have to design a singelton claa such that if the user try to create second object then it should direct to first instance of class.
Please suggest me that how to implement such class
Thanks
|
|
|
|
|
1.Make the constructor of the class private.
2.Write a static function that return the object of this class. In that function create a static object of the same class and return the reference of that object. Thus instead of creating a object directly, call this function to get an instance of the class.
eg:-
class single
{
private:
single()
{
}
public:
static single& Instance()
{
static single Obj;
return Obj;
}
};
here every application should call single::Instance() to get an instance of the class single
|
|
|
|
|
I think Instance() should be public, right?
- NS -
|
|
|
|
|
Thanks Naveen
Will this code ensure that when we are going to create second object of the class then it will point to the first one.
Please explain how.
Thanks
|
|
|
|
|
Ya.. since the constructor is private, u cannot create an object directly. You have to call the Instance() function to get the one and only one object of that class.
eg :-
single a;// causes error since the constructor is private.
single &a = single::Instance(); // reference to the one and only one object.
nave
|
|
|
|
|
Hi!
I use Johan Rosengren's Files "Controls-in-controls: A line-numbering edit box" for line numbering in an SDI application.
I have changed it to CEditView to get it working.
The problenm is: After the visible area of the edit-control doesn't apprear a vertical scroolbar. Instead the cursor jumps into a new line. And also if I make the whole window smaller, the text which doesn't have enough place jumps into a new line.
How can I make a scrollbar in this case?
I hope you know what I mean, my English isn't the best.
|
|
|
|
|
Hi there,
I have a CTreeCtrl as a child of a docking window (CMyBar). In my docking window class I set a handle just like this:
(CMyBar.cpp)<br />
ON_NOTIFY(TVN_SELCHANGED, ID_TREE, OnTreeChange) .. .
The declaration of the function is
(CMyBar.h)<br />
afx_msg void CMyBar::OnTreeChange(NMHDR *hdr, LRESULT *NotUsed)<br />
I had to explicity add the ON_NOTIFY handler because the Visual Studio6 ClassWizard doesn't show the ON_NOTIFY event for my docking class (CMyBar), (don't know why?).
As far as I know CTreeCtrl does send ON_NOTIFY notifications to it's parent (CMyBar). Spying++ CMyBar window class shows CMyBar gets WM_NOTIFY messages...
Now all this crap doesn't work (OnTreeChange never gets called), and I'm to figure out what's going on and what's wrong with it.
Would be really happy if someone can answer this question...
Thank you!
|
|
|
|
|
I have two C++/WinAPI (non-MFC) classes which draw buttons. One simply uses default drawing; the other implements custom drawing.
Recently, I added a manifest for CommCtrl6 to get the "XP Styles".
The control class that uses custom drawing is working fine -- it recognizes whether themes are present and if so, uses DrawThemeBackground (with the appropriate parameters) to produce the desired results. [otherwise it used DrawFrameControl].
However, the control that uses purely default drawing isn't behaving as I'd expect. The control draws the approriate XP-Style button, but it always frames it with a 1-pixel black rectangle. I've inspected the button's style and extended style flags, and neither BS_DEFPUSHBUTTON nor WS_BORDER is set.
Why is the control being framed and how do I get rid of it??
Rick Aurbach
|
|
|
|
|
Dear all,
I have a simple problem, i hope to get your valuable opinions on it.
Okey, so i have built an MFC application. The main application has a modeless child dialog that is only created when a menu item is clicked.
the modeless child dialog has edit controls which receive input from the user. Now, user input will be used to modify some global variables in the parent class to be used for some purposes.
Let's assume the parent class has the following global variables : xParent, yParent.
the modeless child dialog has two edit controls and one button "Set". the two edit controls save the input to xChild and yChild.
When the user clicks "Set", the variables of the parent [xParent, yParent] should be set to [xChild, yChild] respectively.
How can i do that ? I am thinking to declare an instance of the parent class within the child class and modify the parents variable within the click event of the "Set" button.
Do you think its the best approach to solve this problem ?
Thanx
llp00na
|
|
|
|
|
Try sending a message (WM_USER + N) to the child / parent ...
Maxwell Chen
|
|
|
|
|
would you please clarify more.Whats the purpose of the message (WM_USER + N)???
llp00na
|
|
|
|
|
Please read this[^].
Maxwell Chen
|
|
|
|
|
reinterpret_cast<cmyframewnd *="">(AfxGetApp())->xParent = 5;
|
|
|
|
|
//By this you can set the value of parent member variable from child window.
reinterpret_cast<cmyframewnd *="">(AfxGetApp())->xParent = 5; // AnyValue
|
|
|
|
|
I tried using this method but its giving me a compilation error
llp00na
|
|
|
|
|
llp00na wrote: When the user clicks "Set", the variables of the parent [xParent, yParent] should be set to [xChild, yChild] respectively.
The child will need two variables to hold the values of xChild and yChild . These variables will exist even after the modeless child dialog is dismissed. The parent can access them whenever it needs to.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|