|
No unicode.
I'm about ready to shell out the $500 bucks for HalloGram's Ultimate Grid.
Thanks for walking through this with me.
If I ever get this to work, I am going to submit an article that walks a newbie to MFC through getting the thing to function.
|
|
|
|
|
Don't be discouraged. I am not sure what your problem is but it should not be too hard to fix. I have used the grid in at least 5 of my applications...
John
|
|
|
|
|
Why don't you try creating a simple dialog application and place a grid in it to see how to get it working?
John
|
|
|
|
|
Do you have UCHAR or ULONG defined in any of your files?? That looks like it is the problem..
This is line 369 of wtypes.h
typedef unsigned char UCHAR;
To me the error says that UCHAR is defined as char already...
[EDIT]
I tested this theory by putting a
#define UCHAR char
in my stdafx.h file and I got the following errors:
StdAfx.cpp
d:\pf\microsoft sdk\include\windef.h(47): error C2632: 'char' followed by 'char' is illegal
d:\pf\microsoft sdk\include\windef.h(47): warning C4091: 'typedef ': ignored on left of 'unsigned char' when no variable is declared
d:\pf\microsoft sdk\include\wtypes.h(379): error C2632: 'char' followed by 'char' is illegal
d:\pf\microsoft sdk\include\wtypes.h(379): warning C4091: 'typedef ': ignored on left of 'unsigned char' when no variable is declared
d:\pf\microsoft sdk\include\sqltypes.h(109): error C2632: 'char' followed by 'char' is illegal
d:\pf\microsoft sdk\include\sqltypes.h(109): warning C4091: 'typedef ': ignored on left of 'unsigned char' when no variable is declared
[/EDIT]
John
|
|
|
|
|
Exactly!
I double clicked on the compile error and found that line in wintypes.h.
I commented it and the other typedef error out .
When I got a good compile, I guessed that it must have been defined in one of the GridCtrl files - or else there would have been an error.
So after I commented it out and built the executable, I uncommented it again and as of 2 minutes ago it was working.
Now I'm going to dig through GridCtrl files to see how it was defined. Hopefully it was defined the same way as in wintypes.h
I was just checking back in to thank you again and tell you what the problem was
|
|
|
|
|
Okay - I found the culprit. I was assuming the redefinition was in the GridCtrl files, but it is in the Victor Image Library files I am using. God help me if the Victor library definition is different that the Windows typedefs........
|
|
|
|
|
Oh man. Now that I got it to compile I am trying to use it.
In my OnInitDialog handler, I set the columns to 10 and rows to 10 and set the first row as a fixed row. no prob - looks great.
Also in OnInitDialog I called m_Grid.SetItemText(1, 1, "ID"); and it returned FALSE - failure.
Is there an entire bunch of initialization hoops I need to jump through?
I was hoping I wouldn't need to start carving out pieces of the example project. The docs looked easy enough for me to jump right in but it just isn't happening for me..........
|
|
|
|
|
Have you tried tracing the calls using the debugger?
cheers,
Chris Maunder
|
|
|
|
|
Have you declared IDC_GRID in your resource.h file?
cheers,
Chris Maunder
|
|
|
|
|
Hey there!
Thanks for making this tool available to us all. I was looking for a grid and couldn't find anything except for Active-X controls. Yours seemed to be just what I was looking for.
Chris Maunder wrote:
Have you declared IDC_GRID in your resource.h file?
It is declared and appears properly when I click the button to display the dialog box that contains it. The calls to m_Grid.SetColumnCount();, m_Grid.SetColumnCount(); & m_Grid.SetFixedRowCount(); work fine and the grid displays with the proper number of rows, columns and fixed rows.
But when I go the next step and call m_Grid.SetItemText(1, 1, "ID"); it returns FALSE.
Note that all of the above calls are in my OnInitDialog handler.
=============== EDIT =====================
Nevermind I discovered the problem. I was trying to set the text of the first (fixed) row but forgot to reference it as the zeroeth row. EXCELLENT work!!!!!!!!!!!!!!!!
|
|
|
|
|
In your resource file:
#define IDC_GRID 1004 In your header:
#include "GridCtrl_src/GridCtrl.h"
class CGridCtrlDemoDlg : public CDialog
{
public:
...
CGridCtrl m_Grid;
In your implementation file:
...
void CGridCtrlDemoDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
...
DDX_Control(pDX, IDC_GRID, m_Grid);
}
...
BOOL CGridCtrlDemoDlg::OnInitDialog()
{
m_Grid.[SetSomeProperties...];
cheers,
Chris Maunder
|
|
|
|
|
Hi,
I have a doubt. How can I do to change the menu prompt at runtime ?
thanks.
|
|
|
|
|
menu prompt ?
the menu item text or the text that is displayed in the status bar when moving the mouse over a menu item ?
the first one is simple, use CMenu::ModifyMenu
the other things, I don't know .
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
Hi,
Actually, I'm talking about the text that is displayed in the status bar when moving the mouse over the menu...
Can you help me ?
|
|
|
|
|
Often that text is retreived from your accelerator table or string table (recources!).
the only thing you can do (as far as my knowledge go's) is harcode the tooltips...
good luck, I think you need it...
A student knows little about a lot.
A professor knows a lot about little.
I know everything about nothing.
|
|
|
|
|
Dear Friends
As it is my first time to get a grip to commport, I've lots of problem with it, I used file operation method but it doesn't work properly, and notify by error 6 & 5.
I'd be appreciated if you could take a look at my code as bellow as advise me in this case
Regards
BOOL CMainFrame::InitSerialPort()
{
DCB dcb;
BOOL fSuccess;
char *pcCommPort = "COM1";
m_hComPort = CreateFile( pcCommPort,
GENERIC_READ | GENERIC_WRITE,
0, // comm devices must be opened w/exclusive-access
NULL, // no security attributes
OPEN_EXISTING, // comm devices must use OPEN_EXISTING
0, // not overlapped I/O
NULL // hTemplate must be NULL for comm devices
);
if(m_hComPort == INVALID_HANDLE_VALUE)
{
// Handle the error.
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
return FALSE;
}
fSuccess = GetCommState(m_hComPort, &dcb);
if (!fSuccess)
{
// Handle the error.
AfxMessageBox("GetCommState failed with error %d.\n", GetLastError());
return FALSE;
}
dcb.BaudRate = CBR_9600; // set the baud rate
dcb.ByteSize = 8; // data size, xmit, and rcv
dcb.Parity = NOPARITY; // no parity bit
dcb.StopBits = ONESTOPBIT; // one stop bit
fSuccess = SetCommState(m_hComPort, &dcb);
if(!fSuccess) //////////// this line hs been repeated ////////
{
// Handle the error.
AfxMessageBox("SetCommState failed with error %d.\n", GetLastError());
return FALSE;
}
return TRUE;
}
//**************************************************************************************************
void CMainFrame::OnCommClose()
{
m_ComPortOpened = FALSE;
m_isRunning = FALSE;
|
|
|
|
|
soobot wrote:
AfxMessageBox("SetCommState failed with error %d.\n", GetLastError());
AfxMessageBox() does not do variable substitution.
|
|
|
|
|
replace all of MessageBox's with
CString str;
str.Format("CreateFile failed with error %d.\n", GetLastError());
AfxMessageBox(str);
Then repeat your problem in board message.
If u wanna give a fast conclusion your message should be in first page of the forum.
|
|
|
|
|
Hi,
I have scanned in graphs which are now available in bitmap format and I wanna programmatically convert its curves (i.e. significant points) to coordinates expressed in numbers.
Please give me advice.
Bunburry
|
|
|
|
|
Hello,
I want to change FONT from one type to another type. Courier to Arial for example. Which function can help me to do that?
Thanks a lot.
|
|
|
|
|
Actually, your question is quite ambiguous but with my sixth sense around I try to answer your question.
I assumed you are talking about DC painting or drawing in a formview or dialog. To change a font type, codes are as below and comments do the explanation.
<br />
CFont oFont;<br />
oFont.CreateFont(11, 6, 0, 0, FW_THIN, FALSE, FALSE, FALSE,DEFAULT_CHARSET, OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS, PROOF_QUALITY, DEFAULT_PITCH | FF_MODERN, "Arial");
<br />
CFont* oPreviousFont = (CFont*) pDC->SelectObject(&oFont);<br />
<br />
COLORREF colPreviousTextColor = pDC->GetTextColor();
pDC->SetTextColor(RGB(255,0,0));
<br />
RECT _rect;<br />
GetClientRect(&_rect);<br />
CRect oRect(_rect);<br />
pDC->DrawText("Hi, I am in Arial ",oRect,DT_RIGHT);
pDC->SetTextColor(colPreviousTextColor);
pDC->SelectObject(oPreviousFont);
Hope this helps.
|
|
|
|
|
How can I use the method loadfile for ADOBE ACROBAT CONTROL ACTIVEX
from ActiveX container Tester. I have tried to put full path to
specific .pdf file and set to VT_BSTR for parameter type. Seems
it doesn't do anything. anyone has same problem before and managed
to solve?
Thanks
Shin
|
|
|
|
|
I am making a timer program but I want it to stop at a certain number like 300. I made it so it counted but the timer wouldn't stop at a certain number i.e. 300.
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|
|
|
if(m_iCount == '300')<br />
{<br />
KillTimer(ID_TIMER);<br />
m_cStart.EnableWindow(TRUE);<br />
}
I have this in my Start button but I just realized that, that place is not a
very good choice (YAY). But I still don't know were to put it.....
[It is possible to represent everything in this universe by using 0 and 1]
I was born intelligent
Education ruined me!.
An idea is useless until it has been implemented.
|
|
|
|