|
In OnInitialUpdate.
RECT rc = { 10, 10, 100, 100 };
m_Button.Create("Caption", WS_VISIBLE | WS_CHILD, rc, this, 1);
m_Button.ShowWindow(SW_SHOW);
The 1 is the ID, I suggest creating an ID range in resource.h and using it for dynamically created buttons, then use OnCommand to capture their being pressed. Michael Dunn gave some good advice on how this works in the thread on WTL dynamic buttons I started.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Hi again all of you,
Does anyone know of some code that has been written to switch splitter layouts? Is this even possible to do? Because I want the initial views to be destroyed; I want to use them in the new layout.
What I mean is that if for instance you have a frame layed out with splitters in a 2x2 way, I want to be able to click a button to switch to a 3x1 layout (that is a 2 column splitter where the first column has a nested 3 row splitter)?
Thx,
/Tommy
|
|
|
|
|
You can use the DeleteColumn(), DeleteView() and DeleteRow() to remove them. See MSDN.
|
|
|
|
|
I tried to do something similar and wasn't sure if it was possible. My workaround was to make the first column in the splitter another CFrameWnd and then split that one to two rows.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hi all MFC pro's,
Have you ever nested a splitter inside another static splitter? Of course you have.
I've noticed a bug in CSplitterWnd here. Say we have a 2 column splitter where the left column encapsulates a 2 row splitter. Got it?
Ok, so whenever I click the vertical splitter bar without actually moving it, the bar moves approx. 2 pixels to the right...!??!!?!?!? Anyone knows how to get rid of this pretty annoying behaviour? It would mean a great lot to me!
Thx,
/Tommy
|
|
|
|
|
Just move the damn thing using SetColumnInfo..
|
|
|
|
|
How do you mean...? After I release the mouse button, call setcolumninfo with 2 pixels in the opposite direction... that's ugly!
|
|
|
|
|
What are the functions to convert Char to Byte and vs.
In Pascal:
Chr(65) returns an 'A' and
Ord("A") returns 65.
I've looked in every C++ book I've got and can't find this one. Duh!
Richard
|
|
|
|
|
Char and int are interchangable, so int a = 'A' would be ( from memory) 65, and assuming I am right, char A = 65 would equal 'A'.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
Or if you want to emphasize casting, you can do something like:
int a = (int) 'A';
char a = (char) 65;
but this is just a matter of taste, of course...;P
I vote pro drink
|
|
|
|
|
I am trying to make a toolbar with rearrangable buttons. After not being able to figure this out, I've settled for trying to allow my toolbar to be customized, which does drag/drop automatically.
According to MSDN docs, the customize dialog sends the messages TBN_QUERYDELETE and TBN_QUERYINSERT, and expects booleans returned. If those are WM_NOTIFY messages, then I only know how to handle them with afx_msg void functions.
Any help with this would be appreciated, including anything about dragging toolbar buttons
thanks a lot,
Jake
|
|
|
|
|
Store the return value in the handler's *pResult parameter.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
My main problem here is that when the Customize dialog begins to show, it disappears again. It's there for less than a second, and my functions to handle the query delete and insert never get called.
In the message map:
ON_NOTIFY(TBN_QUERYDELETE, IDR_TOOLBAR1, OnQueryDelete)
ON_NOTIFY(TBN_QUERYINSERT, IDR_TOOLBAR1, OnQueryInsert)
In the header file:
afx_msg void OnQueryDelete(TBNOTIFY *tbn, LRESULT *result);
afx_msg void OnQueryInsert(TBNOTIFY *tbn, LRESULT *result);
Why is the dialog vanishing without ever calling these functions?
thanks,
Jake
|
|
|
|
|
When I tried placing a RichEdit control in a dialog box, the dialog box would not show when its DoModal function was called. When I removed the RichEdit control, the dialog box showed fine.
What is really odd is the fact that in another project I had a RichEdit control on a property page, and there the dialog box, RichEdit control and all, displayed normally.
Has anyone else had this happen to them? Is there a way to get a popup dialog box with a RichEdit control to display?
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
Yu have the AfxInitRichEdit( ); in your CWinApp::initinstance()????
Cheers!!!
Carlos Antollini.
|
|
|
|
|
Didn't do that. Will put that in. Thanks.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
did you call AfxInitRichEdit();?
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|
|
I know, I know, this is not a Visual C++ quesiton, but given the fact that most people hitting this site are here for VC++ questions (myself included, ususally), I figured that this would be the best place to give this question exposure.
Any way, I have the following code in a custom Outlook Appointment Form. When I open a new appointment, I get a "Syntax Error" error (reduntant, I know... ). Any idea why?
Function Item_Open()
Dim Insp
Dim Bar
Dim Btn
Set Insp=Item.GetInspector
Set Bar=Insp.CommandBars.Item("Standard")
'Syntax Error appears on this next line...
Set Btn=Bar.Controls.Add(Type:=msoControlButton, Before:=2)
With Btn
.Caption="Board Room"
.FaceID=0
.OnAction="OnBoardRoom"
End With
End Function
Thanks in advance.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
I would like to know how we could insert an icon in a dlgbox
thanks in advance
gerald
|
|
|
|
|
Put a picture control in te dialog box.
Select the properties of picture control.
In the propertie dialog select change the type propertie for Icon.
You will see that the Image Combo box will be enabled. Select in this the resource that have your icon.
Is OK?
cheers!!!!
Carlos Antollini.
|
|
|
|
|
Hi,
I am developing a Document/view application that display different kind of curve. To do so i've used a common CView derived class... but now I want to add some control inside my view on the drawing area. Just for a demo I've insert "false button". ie bitmap picture and I'm trapping their position on LButtonDown... so it's just for demo.
For now I'm seaching a good tutorial or code example who give me the possibility to add all kind of control in a view. I still need to be able to draw (whit dc's function) and to use splitter curve.
So if anyone have something who can help
thank
Rémi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
I'm almost certain you can't add a control to a CView-derived vie wusing the resource editor. You would have to try it programmatically. One idea is to declare a member variable of type CButton, initialize it in your view class's constructor, and then call its Show function in the view's OnDraw function.
I must admit, I'm not entirely clear as to how you would go about handling events from such a button. I believe you have to assign a control ID to the button and use the ON_BN_CLICKED macro to map the message to a specific function.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
Hehe!
Same for me it's the only thing I've found but for now I was'nt able to assing an Id and I don't want to edit myself the ressources. So I derived the class of the control I wanna use and override everything I need. It's not clean but it work... to my mind they must exist a better way to do so.
Still waiting for!
Thank you for you'r answer
Remi Morin
Rmorin@Operamail.com
Remi.Morin@Lyrtech.com
|
|
|
|
|
To assign an ID you just use one of those #define macros. Editing the resource file won't help because everytime the resources are compiled or edited, or soemthing like that, the resource file is erased and written anew.
"What would this country be without this great land of our?" -Ronald Reagan
|
|
|
|
|
The way to declare IDs is to go to the Resources tab, right click on the top level folder and select Resource Symbols. It has an icon of text "ID=", which demonstrates its use as defining global IDs. Click "new" and you can make "ID_BUTTON_SOMETHING" and then use that anywhere in your project.
Handling that button will require adding an entry to the message map. In the cpp file of the class you want to receive the message (your view class, most likely), after the BEGIN_MESSAGE_MAP, add the entry:
ON_COMMAND(ID_BUTTON_SOMETHING, OnButtonSomething).
Button clicks should automatically call the function OnButtonSomething, which you will need to declare in the header file (afx_msg void OnButtonSomething()) and implement in the cpp file.
Hope this helps
Jake
|
|
|
|