|
Hi. What I want to do is create an application (Doc/View app) that does this:
1) places a widget on the (Doc/View) drawing area
2) allows the user to drag the widget to another area on screen
3) when widget is double-clicked, a new "window" opens - could be a dialog, or another View window.
4) point-click to connect widgets with a line
I did a quick search in CodeProject and found the DDRmgr example,
Drag-Drop Manager for CObjects by Wes Rogers (http://www.codeproject.com/clipboard/ddmgr.asp?target=drag%7C%2Bdrop)
but want more/another example.
Can anyone help with this?
Thanks,
Johnny
|
|
|
|
|
I have a crude example (in Flash 6, 4.5kb) if want to see more details.
-- regards, Johnny
|
|
|
|
|
OK...here is my problem...
I have an mdi aplication vith a toolbar. The toolbar has 3 buttons. any of this 3 buttons open a different view window.
button 1 -> view hith a combobox
button 2 -> view with a editbow
button 3 -> view with a list control.
so far so good. My problem is that i must "erase" the close minimize and maximize buttons form the title bar and I don't know where to do it. I tried in CMDIChildFrm :: OnPreCreateWindow to modify the cs but I managed to do that only for my first window that I open. When I open the other 2 buttons they still have the max, min and close buttons.
Question is Where and how I must define the style for all 3 view windows so that when I create them they will be created without the min, max & close buttons.
sorry for my bad english
|
|
|
|
|
Good English, very good infact!
Set a pointer to the window (the button) GEtSafewh...
The show or hide them at will.
Best Wishes,
ez_way
|
|
|
|
|
In a dialog based program ,I have a default constructor like this:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/)
: CDialog(CUpdateRcrd::IDD, pParent)
{
//{{AFX_DATA_INIT(CUpdateRcrd)
m_vtName = _T("");
m_vtPass = _T("");
m_vtUsername = _T("");
m_vtUrgent = _T("");
m_vtPhone = _T("");
//}}AFX_DATA_INIT
}
I wanna add and use my own constructor.A constructor that takes one integer argument.I add my own constructor via member function and made an instance of my object,using the new constructor.but the appliction crashed at run time.Can anyone help?It's a matter of life and death.
|
|
|
|
|
|
You could just add an interger argument to the origanal constructor thus:
CUpdateRcrd::CUpdateRcrd(CWnd* pParent /*=NULL*/, int n /*=0*/)
You could make a copy (cut & paste) of the origanal and use it as a bases for your new constructor.
You could pull out the intialization code from the origanal constructor and store it in a sperate member function that is call by all additional constructors that you create.
No matter how you go about it, what ever the origanaly constructor is doing you must do the same thing in any constructor you create. If you are not doing this then some thing is not being initialize to a known state durring construction and a what do you know it crashes.
INTP
|
|
|
|
|
Hi, im considering learning about writting apps for the palm os, and i have found tons of info, APIs, etc. but i cant seem to find exacly WHAT do i need to compile this kind of applications.
Can VC6 be used for this? or do i need to get (aka BUY) another IDE, compiler, etc.?
Thanks!
|
|
|
|
|
The best bet is to buy another IDE such as CodeWarrior or look for similiar IDEs in the GNU community.
I'm not familiar with the latest Palm OS (past ver 4.1), but the Palm OS is/was based upon the Motorola processor. The apps one writes and places on the Palm are embedded system applications.
If you are only writing Conduits (the apps that handle updating the Palm/PC during a HotSync), then VC++ IDE can do the job for you.
More info?
Johnny
|
|
|
|
|
|
Falch.NET is a better IDE than Code Warrior because it is cheaper, and looks like VC6. Code Warrior is annoying to use, although it may be just that it was unfamiliar. As Michael said, try searching first, there's a whole section here on Palm articles.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
When I am coping/pasting from my c++ program to the notepad the \n's are not coming through.
I get little squares instead of carriage returns.
The string is unicode, but it does not work even when I save-as notepad file as unicode.
Do you know what the problem is and how I can get around it?
ANy help would be greatly appreciated.
Here is my code that puts the string on the clipboard:
void OnCopyButtonClicked()<br />
{<br />
CString strData;<br />
CString strWarningHeader, strErrorHeader, strInfoHeader;<br />
<br />
strWarningHeader.LoadString(IDS_INVENTOR_WARNING_LABEL); <br />
strErrorHeader.LoadString(IDS_INVENTOR_ERROR_LABEL);<br />
strInfoHeader.LoadString(IDS_INVENTOR_INFO_LABEL);<br />
<br />
std::vector<InventorErrorMessageStruct>::iterator iter;<br />
for (iter = m_errorStructList.begin(); iter != m_errorStructList.end(); ++iter)<br />
{<br />
InventorErrorMessageStruct messageStruct = (*iter);<br />
<br />
if(strData.GetLength() > 0)<br />
{<br />
strData.Insert(strData.GetLength(), _T("\n\n"));<br />
}<br />
if(messageStruct.messageType == CErrorListBox::MESSAGE_ERROR)<br />
{<br />
strData.Insert(strData.GetLength(), strErrorHeader);<br />
}<br />
else if(messageStruct.messageType == CErrorListBox::MESSAGE_WARNING)<br />
{<br />
strData.Insert(strData.GetLength(), strWarningHeader);<br />
}<br />
else if(messageStruct.messageType == CErrorListBox::MESSAGE_INFO)<br />
{<br />
strData.Insert(strData.GetLength(), strInfoHeader);<br />
}<br />
strData.Insert(strData.GetLength(), _T(" "));<br />
strData.Insert(strData.GetLength(), messageStruct.message); <br />
}<br />
<br />
if (OpenClipboard())<br />
{ <br />
EmptyClipboard();<br />
<br />
HGLOBAL hClipboardData;<br />
hClipboardData = GlobalAlloc(GMEM_DDESHARE, <br />
(strData.GetLength() + 1) * sizeof(wchar_t)); <br />
<br />
wchar_t* pchData;<br />
pchData = (wchar_t*)GlobalLock(hClipboardData);<br />
<br />
wcscpy(pchData, LPCTSTR(strData)); <br />
GlobalUnlock(hClipboardData); <br />
SetClipboardData(CF_UNICODETEXT,hClipboardData);<br />
CloseClipboard();<br />
}<br />
}
Elena
|
|
|
|
|
Hi
Try this please
Make a new dlg project and place a button and a edit contrrol on it. Do NOT make the edit control multi-line.
Name a str member var for the edit control named say m_strEdit.
Add the following to the button.
OnBottonClick()
m_strEdit.Format("hello world\r\n hello world\n hello world\r");
Update Data(FALSE);
Easy right?
Now copy the contents of your editcontrol to notepad and see what you get.
Answered your own question,,, right?
Best Wishes,
ez_way
|
|
|
|
|
It has been a while, but a think that you need to use "\r\n" (a.k.a. CR/LF)at the end of each line of text that you are copying to the clipboard, not "\n". When you are working with edit controls, or an CEditView derived class, you will find out very quickly that it does not recognise "\n" and does recognise "\r\n".
INTP
|
|
|
|
|
I want to continually update the data in the edit boxes on my dialog box with data that is generated in a loop. For example:
for( i=0; i<100; i++)
{
m_X += 1;
UpdateData(FALSE);
}
However, when I try this it loops through the for loop and doesn't display the values until it reaches the end of the loop. Thats when it displays 100.
Any help would be appreciated. Thanks
|
|
|
|
|
The problem is that the thread that executes your for loop is the same thread that draws the GUI of your app. In order to solve your problem you have to create a workerthread. That thread must have a way to comunicate with your gui.
If your ussing MFC the safe way to do it is passing the HWND of the dialog box or the HWNDs of the controls you want to update and use SendMessage/PostMessage to update their contents.
To create a worker thread ( a worker thread does not handle any UI events, it does not own a window ) you can call:
CWinThread* AfxBeginThread(
AFX_THREADPROC pfnThreadProc,
LPVOID pParam,
int nPriority = THREAD_PRIORITY_NORMAL,
UINT nStackSize = 0,
DWORD dwCreateFlags = 0,
LPSECURITY_ATTRIBUTES lpSecurityAttrs = NULL
);
pfnThreadProc - this is your thread function,it has the following proto:
UINT MyControllingFunction( LPVOID pParam );
pParam - can be anything you want, and it is what you recive in pParam in MyControllingFunction (usualy in MFC a HWND)
"I don't want to achieve immortality through my work... I want to achieve it through not dying."
Woody Allen
|
|
|
|
|
|
Hello All
I have a Win32 C++ application. The parent form has various edit boxes on it and on selection of one of these boxes a dialog box (created using DialogBox) is opened. This dialog box has a date-time picker control on it and allows the user to select a date. Once a date is selected and a button pressed on the dialog box the date is tranferred to the underlying edit box, a child control on the parent window. Now my problem is this... selection of the date works fine and the information is passed to the underlying edit control. The dialog box disappears as you would expect, but when you use the mouse to try and select one of the other edit boxes on the parent form the aforementioned dialog box reappears. This happens several times before I am finally allowed to select one of the other edit controls with the mouse. I have tried changing the focus when the dialog box closes (EndDialog) but the same still happens.
Does anyone have any ideas as to what I might be doing wrong. I am in the middle of writing a small app to try and show what is going on and I'll post this when done, but if anyone has any ideas then their help would be gratefully appreciated.
Cheers
|
|
|
|
|
Hi
Show us some code,.... where you call the dlg with the dtpicker.
Best Wishes,
ez_way
|
|
|
|
|
Hi All
This is a small application I have put together to highlight my problem. Basically it consists of a parent window with a button and RichEdit control on it. When you select the RichEdit control a dialog box appears that has a date/time picker on it and another button. Selecting the date/time picker allows you to select a date and on pressing the button on the dialog box the information is transferred to the underlying RichEdit box. The dialog box closes. However, if you then try to select one of the parent window controls with the mouse (the button for instance) the dialog box reappears... Is there something I am (or am not) doing correctly?
Heres the Applications :
#include "stdafx.h"
#include "richedit.h"
#include "resource.h"
#define WINDOW_CLASS_NAME "WINCLASS1"
HWND CreateButton(char* tempText, int x, int y, int width, int height,
int identifier, HWND hwnd, HINSTANCE hInstance);
HWND CreateRichEdit(char* tempText, int x, int y, int width, int height,
int identifier, HWND hwnd, HINSTANCE hInstance);
BOOL CALLBACK DateDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam);
HWND main_window_handle = NULL;
HINSTANCE main_hInstance = NULL;
HINSTANCE relib;
HWND eDate = NULL;
LRESULT CALLBACK WindowProc(HWND hwnd,
UINT msg,
WPARAM wparam,
LPARAM lparam)
{
PAINTSTRUCT ps;
HDC hdc;
switch(msg)
{
case WM_CREATE:
{
relib = LoadLibrary("riched32.dll");
//Create a Button on the main form
HWND bDateSelect = CreateButton("Select Date",10,250,100,25,101,
hwnd,main_hInstance);
//Create a RichEdit Box on the main form
eDate = CreateRichEdit("",10,30,200,25,102,
hwnd,main_hInstance);
return (0);
} break;
case WM_PAINT:
{
hdc=BeginPaint(hwnd,&ps);
EndPaint(hwnd,&ps);
return(0);
} break;
case WM_DESTROY:
{
PostQuitMessage(0);
return(0);
} break;
case WM_COMMAND:
{
switch(LOWORD(wparam))
{
case 102:
{
if(HIWORD(wparam) == EN_SETFOCUS)
{
DialogBox(GetModuleHandle(NULL),MAKEINTRESOURCE(IDD_DATE),
hwnd,DateDlgProc);
}
} break;
}
} break;
default:break;
} //End of Switch
return(DefWindowProc(hwnd,msg,wparam,lparam));
}
BOOL CALLBACK DateDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
case WM_INITDIALOG:
return true;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
{
//Get the information from the DateTimePicker Control and Return it
HWND hwndCtrl = GetDlgItem(hwnd,IDC_DATETIMEPICKER1);
//Store the data
char date_Store[20];
int date_Length = SendMessage(hwndCtrl,WM_GETTEXTLENGTH,0,0);
SendMessage(hwndCtrl,WM_GETTEXT,(WPARAM)date_Length+1,(LPARAM)date_Store);
//Set the text in the RichEdit box for date of birth
SendMessage(eDate,WM_SETTEXT,0,(LPARAM)(LPCTSTR)date_Store);
EndDialog(hwnd,IDOK);
} break;
} break;
default:
return false;
}
return true;
}
//*******************************************************************
//* This function creates a Button
//*******************************************************************
HWND CreateButton(char* tempText, int x, int y, int width, int height,
int identifier, HWND hwnd, HINSTANCE hInstance)
{
HWND hbuttonTemp; //Handle to temporary Bitmap Button
hbuttonTemp = CreateWindowEx(
WS_EX_CLIENTEDGE,
"BUTTON",
tempText,
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
x, y,
width, height,
hwnd,
(HMENU)identifier,
hInstance,
NULL);
return hbuttonTemp; //Return the handle
}
//*******************************************************************
//* This function creates a RichEdit box
//*******************************************************************
HWND CreateRichEdit(char* tempText, int x, int y, int width, int height,
int identifier, HWND hwnd, HINSTANCE hInstance)
{
HWND hrichEditTemp;
hrichEditTemp = CreateWindowEx(
NULL,
RICHEDIT_CLASS,
tempText,
WS_CHILD | WS_VISIBLE | ES_SUNKEN | ES_UPPERCASE,
x,y,
width,height,
hwnd,
(HMENU)identifier,
GetModuleHandle(NULL),
NULL);
return hrichEditTemp;
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
WNDCLASS winclass;
HWND hwnd;
MSG msg;
winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW;
winclass.lpfnWndProc = WindowProc;
winclass.cbClsExtra = 0;
winclass.cbWndExtra = 0;
winclass.hInstance = hInstance;
winclass.hIcon = LoadIcon(NULL,IDI_APPLICATION);
winclass.hCursor = LoadCursor(NULL,IDC_ARROW);
winclass.hbrBackground = (HBRUSH)GetStockObject(GRAY_BRUSH);
winclass.lpszMenuName = NULL;
winclass.lpszClassName = WINDOW_CLASS_NAME;
//Register the Window Class
if(!RegisterClass(&winclass))
return(0);
//Create the main window
if(!(hwnd=CreateWindow(WINDOW_CLASS_NAME,
"Date and Time Picker Dialog",
WS_OVERLAPPEDWINDOW | WS_VISIBLE,
0,0,320,320,
NULL,NULL,
hInstance,NULL)))
return(0);
//Save the Window handle in a global
main_window_handle = hwnd;
main_hInstance = hInstance;
//Enter the main event loop
while(1)
{
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{
if(msg.message == WM_QUIT) break;
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return(msg.wParam );
}
Any help would be gratefully appreciated.
Cheers
Billy
|
|
|
|
|
It looks as though you're getting an extra EN_SETFOCUS, then. Have you tried using SPY++ to see what messages the RichEdit window is getting, and when?
Steve S
|
|
|
|
|
hello,
i am coding in c++ (mfc) i have addded a list box to my aplication,im having torouble parsing data into my listbox,i have a preparsed buffer contaning the data i want to go into the listbox,but when i try to put it in the list box it comes out as 1 big string,but if i send the buffer data to a edit box it is parsed wonderfully,the buffer is parsed with "\r\n" can i add new lines to the listbox,without doing this again
m_strList.AddString(inBuffer);
or is there a way i can read the data line by line form the buffer and the loop the lines into the listbox 1 by 1?
thanks for your time;)
|
|
|
|
|
Hi you are not parsing the buffer just loading it.
Parse it first with a while loop.
Inside the loop load the box.
It may help also to put the buffer contents into a CString the use findrev like
char ch ='\r\n';
while.(condition){
int ix = m_strEdit.ReverseFind(ch);
grab it, stick it.
}
Best Wishes,
ez_way
|
|
|
|
|
Is there a way to send say a structure to program code and have the code tell you the variable type. This would be helpful when debugging you could do this.
send struct abc to determine_type
determine_type reports
struct abc
value 1 = int and is = 102
value 2 = char * and is = ab\0
value 3 = long and is = 190012
value 4 = char and is = R
end of structure..
This allows you to turn on some form of debugging option and report the types and values within each structure.
thanks
|
|
|
|
|
|