|
When I've had to do this, I've created a simple ActiveX control, that draws nothing in it's OnPaint/OnDraw handler. Then, in it's OnCreate, create a child window with all of its associated controls. In the OnSize handler for the ActiveX control, simply resize the single child window.
There are more issues associated with this (such as checking for ambient background colour and TAB order) but this should give you a start.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I'm having a similar kind of problem (see earlier thread). I want an ActiveX control that contains two tree controls, but I can't get it to display anything.
Like you've said my OnDraw handler is empty and I'm creating the trees in OnCreate, but still nothing
Any ideas?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
OK, here's some code I've pulled out of my ActiveX control:
void CMyControl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
{
if (m_ctrlDictSel.GetSafeHwnd())
{
if (m_tRect != rcBounds)
{
m_ctrlDictSel.MoveWindow(rcBounds, TRUE);
m_tRect = rcBounds;
}
else
{
m_ctrlDictSel.Invalidate(TRUE);
}
}
else
{
pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH)));
pdc->Rectangle(rcBounds);
pdc->MoveTo(rcBounds.left, rcBounds.top);
pdc->LineTo(rcBounds.right, rcBounds.bottom);
pdc->MoveTo(rcBounds.right, rcBounds.top);
pdc->LineTo(rcBounds.left, rcBounds.bottom);
}
}
Are you sure your trees are being created correctly? In my OnCreate handler, all I've got is a call to m_ctrlDictSel.Create(...).
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Thanks for the code. I've actually got it sorted now. Nothing was showing up because I didn't have any items in the tree controls
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Hi, hope someone can help me.
I have placed a handful of controls (CEdit, CComboBox etc)in the main window of a CView based app. Everything works fine except, despite including the WS_TABSTOP windows style in the control CREATE function, tabbing does not work.
I'm not coming up with anything useful from the Library.
Has anyone come across this problem..and if so, how is it resolved.
Thanks in anticipation
Jim
Sonork ID: 100.13715 - 3bananas4
I have detailed files
|
|
|
|
|
WS_TABSTOP will work only if you host your control in a dialog - so for 'free' tabstops' you'll need to use CFormView (which is a dialog).
If you plan to keep CView, you'll have to check for WS_TABSTOP (in PreTranslateMessage, for example) and change the focus.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Hi,
I wonder, how much bytes or kilos will add to my ATL DLL file to include this handy header...
If I want to make a light weight component is a good idea to use it ?
Thanks, Bye !
Braulio
|
|
|
|
|
Hello Braulio:
As I know,adding some header files does not effect on size or performance of component so much.
I used ATLControls.h one time and I remember the realease version of component still very small.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Can I build an ActiveX that gives you ability to translate from one language to another language.
Hung Son
|
|
|
|
|
ActiveX can do everything,But for this purpose I don't think it is good idea to write it as ActiveX because the size of your ActiceX will become so huge(I can't imagine how much) and it caused very bad performane.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
But that's an exercise which my teacher give us !
Hung Son
|
|
|
|
|
You could use an ActiveX control to get the input and display the translated output. Using the ATL Appwizard is a good start. A composite control would probably be your best bet.
It would probably be better to build each seperate language as a COM server that could be called from your ActiveX control.
Michael
|
|
|
|
|
I need to create an ActiveX control that uses tree controls. I am very familiar with the CTreeCtrl MFC class and would prefer to use this in the control.
Ordinarily I would just add the controls I needed to a dialog resource and then use ClassWizard to add the revelant member variables and event handlers. I'm very new to ActiveX control creation and I don't seem to be able to find a way of doing what I want to.
Does anyone know how this can best be achieved?
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Derek Lakin wrote:
need to create an ActiveX control that uses tree controls. I am very familiar with the CTreeCtrl MFC class and would prefer to use this in the control
In the last step of creating your project,choose in "create control based on" SysTreeView32 .
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I already thought of that but I actually need two tree controls inside my ActiveX control.
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
Derek Lakin wrote:
I actually need two tree controls inside my ActiveX control.
You mean you don't know how to create second one?
The same as when you create a control in windows appication.
Definr one ,then with Create(),SetWindowPos()
in OnCreate() and OnSize of
your ActiveX.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I've created an ActiveX control using the MFC ActiveX Control Wizard. As standard it inherits from COleControl.
I've added a handler for WM_CREATE which looks like this atm:
int CMyCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (COleControl::OnCreate(lpCreateStruct) == -1)
return -1;
DWORD dwStyle = WS_CHILD | WS_VISIBLE |
TVS_HASLINES | TVS_DISABLEDRAGDROP;
UINT nFlags = SWP_NOMOVE | SWP_NOSIZE;
BOOL bCreate = m_tree.Create(dwStyle, CRect(7, 7, 70, 75), this, IDC_TREE);
if(TRUE == bCreate)
{
m_tree.SetWindowPos(&wndTop, 0, 0, 0, 0, nFlags);
}
return 0;
}
I've also added a handler for WM_SIZE as follows (I'm not worried about sizing yet):
void CMyCtrl::OnSize(UINT nType, int cx, int cy)
{
COleControl::OnSize(nType, cx, cy);
m_tree.SetWindowPos(&wndTop, 7, 7, 70, 75, 0);
}
The only other I've done is to remove the two default lines in OnDraw that fill the background white and draw an ellipse.
At the moment it draws absolutely nothing. I've stepped through and the creat calls, etc. succeed but I don't get a tree control drawn
Derek Lakin.
I wish I was what I thought I was when I wished I was what I am.
Salamander Software Ltd.
|
|
|
|
|
I think it has two reason:
First:
if(TRUE == bCreate)
{
m_tree.SetWindowPos(&wndTop, 0, 0, 0, 0, nFlags);
}
For the forth and fifth element you have to set width and height,here set them to 0,so yout reww control does not have any height and width so you can't see it.
Second:
You didn't add any item to tree control.you won't see anything until you add items.
Hope that helps
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
Lets say I have two objects in my system: Cars and Trucks. They have similar functions: Start, Stop, SetPassengerCount.
Now I want to build Generic pool class so that I can hold and manipulate objects of the above classes, one pool for each class. The pool operations will be the same no matter the “type” of the pool.
When I instantiate a pool I want to tell it what type of pool it should be (Car or Truck) but I have no idea how to do this.
I tried to use void pointers but I really want to be able to “use” the objects from within the pool class. That is to say I want to “Start” , “Stop” the object but obviously I cant do this with void pointers.
I’ve searched the Internet but nothing I found really helps. Can someone suggest a few things that I should be looking into to solve this problem. I’m lost. Help.
|
|
|
|
|
Use a C++ feature called template classes. Any C++ book worth the price of paper is printed on should explain the ideas behind the template concept.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
class Pool<t>
{
};
Pool<car> MyCars;
Pool<truck> MyTrucks;
Good Luck,
Bill
|
|
|
|
|
Sorry, I lost some formatting in that post...
class Pool<T>
{
void Maintain();
T.Start();
};
To use it:
Pool<Cars> MyCars;
Pool<Trucks> MyTrucks;
MyTrucks.Start();
MyTrucks.Maintain();
Good Luck
|
|
|
|
|
I don't know why the formatting doesn't show up. What I was trying to tell you is to create a Template class to wrap either Trucks or Cars. For some reason, I can't get the less than and greater than signs to show up.
Sorry
|
|
|
|
|
If you insist on answering to me (instead of original poster), at least include the 'template' keyword in your example.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, I thought I was. My screen resolution was a little to low. the original icon was out of sight
What do you mean by the "'template' keyword"? How does that help?
Thanks for the help,
Bill
|
|
|
|