|
Hi chaitanya22 ,
Can you be more specific ? what do you need?
|
|
|
|
|
Doesw anybody knows if MS flexgrid supports user input?
I inserted it in project, but I didn't manage to enter any text in a cell. The control is not disabled. Setting cell text by .put_Text works.
|
|
|
|
|
i don't think that is possible with MSFlexGrid.
you could use CGridCtrl[^] for instant editing...
|
|
|
|
|
|
//in class defination
CWnd TempObject;
struct ControlObjects //Represents the dynamically created controls.
{
CWnd *WndObject;
}*ptrControlObjects;
//in member function
ptrControlObjects=(struct ControlObjects*)malloc(sizeof(struct ControlObjects)*numControls);
//necessary or it will give assertion in CreateControl.
for(int numWindObject=0;numWindObject<numcontrols;numwindobject++)
{
ptrcontrolobjects[numwindobject].wndobject="NULL;
}
//problem
ptrControlObjects[0].WndObject-">CreateControl("VALID PARAMETERS");
The above statement creates the control and displays it but not storing the object of the newly created control!! while...
TempObject.CreateControl("VALID PARAMETERS"); ...creates,displays and is able to store the object of the control!!
Can anybody please explain to me?
I want to have same behavior of the dynamic array of the controls(all the controls will be same)
Thanks.
|
|
|
|
|
Solved...
//necessary or it will give assertion in CreateControl.
for(int numWindObject=0;numWindObject{
ptrControlObjects[numWindObject].WndObject=new CWnd;
}
Thanks...
|
|
|
|
|
I'm streaming text into a richedit control usiong ES_STREAMIN, I am also catching the EN_CHANGE for this control in an attempt to implement an auto save feature and an undo/redo feature.
Here is a small sample of the code:
if (strlen(Awaiting))
return -1;
if (RichEdit_SetRTF(hEdit,lpszstr) ) {
ClrHistory();
I have set a breakpoint on each line of that code, aswell as the EN_CHANGE message. All runs in order until the Richedit callback, before proceeding to the next line, the EN_CHANGE is trapped. i.e. We send the text, and everything waits until the EN_CHANGE has been processed.
Problem is, I am not yet ready to process this message. If this is too easy i appologise in advance.
|
|
|
|
|
waldermort wrote: Problem is, I am not yet ready to process this message
I do not think I have understood what your problem exactely is. What is it that you do not want ?
~RaGE();
|
|
|
|
|
I couldn't understand why the EN_CHANGE message was being sent and processed before I had completed that particular function. I guess it was being sent from the control as a SendMessage instead of a Postmessage.
I was not ready to process it since after setting the control text I needed to set some flags and fill some buffers. This was causing my EN_CHANGE handler to process the wrong information.
I have managed to overcome it by setting a few flags and sending a custom message. I now have a fully working auto save/redo/undo/IME-compatible edit box. Guess in future I should never trust exactly when a windows message will be sent.
|
|
|
|
|
waldermort wrote: I have managed to overcome it by setting a few flags and sending a custom message. I now have a fully working auto save/redo/undo/IME-compatible edit box. Guess in future I should never trust exactly when a windows message will be sent.
Ok, glad you have sorted it out. Sorry we could not help earlier.
~RaGE();
|
|
|
|
|
Hello,
I have a project (VS2005) with a dialogBox containing a listBox filled with my drive letters.
I use that code to populate the listbox :
BOOL NewDlgProc_OnInitDialog(HWND hwnd, HWND hwndFocus, LPARAM lParam)<br />
{_TCHAR path[MAX_PATH];<br />
int res;<br />
_tcscpy_s(path, MAX_PATH, _T("*.*"));<br />
res = DlgDirList(hwnd,(LPTSTR) path, IDL_DRIVE, 0, DDL_DRIVES);<br />
if (res == 0)<br />
{<br />
MessageBox(hwnd, _T("No drive available"), _T("Warning!"),MB_OK | MB_ICONINFORMATION);<br />
}<br />
return TRUE;<br />
}
I would like to get the text of the selected item so i wrote the folowing code :
<br />
void NewDlgProc_OnSeldrive(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)<br />
{<br />
LRESULT len=0;<br />
LRESULT index;<br />
index = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETCURSEL, 0, 0);<br />
if (index != LB_ERR)<br />
{<br />
_TCHAR driveText[8];<br />
len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index2, (LPARAM)driveText);<br />
if (gbr_len != LB_ERR)<br />
{<br />
...<br />
}<br />
}<br />
...<br />
}
When i try to debug this code i have in the listbox two items with the folowing text : [-c-] and [-d-].
When i select an item i got in driveText variable something like that :
driveText[0] = 0x0e1c <br />
driveText[1] = 0x0013<br />
driveText[2] = 0x005b '['<br />
driveText[3] = 0x002d '-'<br />
driveText[4] = 0x0064 'd'<br />
driveText[5] = 0x002d '-'<br />
driveText[6] = 0x005d ']'<br />
driveText[7] = 0<br />
I do not understand why i get the first two index. I should have get directly the text '[-d-]'.
Could someone help me ?
Best regards.
|
|
|
|
|
gbruyneel wrote: len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index2, (LPARAM)driveText);
index2 is not defined.
gbruyneel wrote: if (gbr_len != LB_ERR)
gbr_len is not defined.
Other than that, your code snippet worked fine for me.
"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
|
|
|
|
|
Oops I missed the final code :
void NewDlgProc_OnSeldrive(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify)<br />
{<br />
LRESULT len=0;<br />
LRESULT index;<br />
index = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETCURSEL, 0, 0);<br />
if (index != LB_ERR)<br />
{<br />
_TCHAR driveText[8];<br />
len = SendDlgItemMessage(hwnd, IDL_DRIVE, LB_GETTEXT, (WPARAM)index, (LPARAM)driveText);<br />
if (len != LB_ERR)<br />
{<br />
...<br />
}<br />
}<br />
...<br />
}<br />
What are your result is it the same as mine, i have tried to switch to MBCS and i have the same behaviour.
|
|
|
|
|
gbruyneel wrote: ...is it the same as mine,
No.
"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
|
|
|
|
|
Hope I understood your question you need to get text of Listbox
Like this
TCHAR path[MAX_PATH];
int res;
_tcscpy(path, "*.*");
res=::DlgDirList(m_hWnd, path, IDC_LIST2, IDC_STATIC2, DDL_DRIVES);
TCHAR driveText2[256];//[8]
driveText2[0]='\0';
::SendMessage(hwnd, LB_GETTEXT, 0, (LPARAM)driveText2);
|
|
|
|
|
how to return string array from a method?
CString myclass::getStr()
{
CString strarr[]={"JAYARAJ","bala"}
return strarr;
}
i get error ..
how to do it...?
JAYARAJ
|
|
|
|
|
J5121982 wrote: CString strarr[]={"JAYARAJ","bala"}
What are you trying to do here? strarr is not an array like you might think. If you need an array of CString objects, use CStringArray . Otherwise, you'll need something like:
char *strarr[] = {"JAYARAJ", "bala"};
"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
|
|
|
|
|
Your function returns _one_ CString, not an array.
CStringArray myclass::getStr()
{
CStringArray csa;
csa.Add("str1");
csa.Add("str2");
return csa;
}
~RaGE();
-- modified at 8:55 Thursday 30th March, 2006 : Sorry David, you posted while I was writing.
|
|
|
|
|
i got this error
what to do?
error C2558: class 'CStringArray' : no copy constructor available
JAYARAJ
|
|
|
|
|
You cannot use the = operator on a CStringArray, you'll have to use the Copy function.
~RaGE();
|
|
|
|
|
You could use a vector of CStrings:
vector<CString> Doit()
{
CString s;
vector<CString> a;
s = "as";
a.push_back(s);
s = "ass";
a.push_back(s);
return a;
}
Now to use it:
CString s;
vector<CString> a;
a = Doit();
this is this.
|
|
|
|
|
khan++ wrote: s = "ass";//this one is for my boss.
Watch out! He might be reading Code Project...
|
|
|
|
|
Actually I have never seen him. And as far as I can tell, I am still anonymous.
this is this.
|
|
|
|
|
Birthday : Friday 16th December, 1977
Location : Pakistan
unless those informations are false, you're not really anonymous...
|
|
|
|
|
Heyyyyyy!
It was supposed to be confidential.
this is this.
|
|
|
|