Click here to Skip to main content
15,917,059 members
Home / Discussions / C#
   

C#

 
GeneralRe: Using a custom icon from resource file Pin
Paul Silvernail13-Sep-03 7:30
Paul Silvernail13-Sep-03 7:30 
GeneralRe: Using a custom icon from resource file Pin
James T. Johnson14-Sep-03 11:10
James T. Johnson14-Sep-03 11:10 
GeneralFast image adding for ImageList Pin
Jucovschi Petru13-Sep-03 3:55
Jucovschi Petru13-Sep-03 3:55 
GeneralRe: Fast image adding for ImageList Pin
leppie13-Sep-03 4:57
leppie13-Sep-03 4:57 
Generaldebugging in VS stopped working... Pin
Jan R Hansen13-Sep-03 1:19
Jan R Hansen13-Sep-03 1:19 
GeneralRe: debugging in VS stopped working... Pin
Uwe Keim13-Sep-03 2:26
sitebuilderUwe Keim13-Sep-03 2:26 
QuestionWould someone please put me on the right track? Pin
profoundwhispers12-Sep-03 22:53
profoundwhispers12-Sep-03 22:53 
AnswerRe: Would someone please put me on the right track? Pin
J. Dunlap13-Sep-03 9:26
J. Dunlap13-Sep-03 9:26 
profoundwhispers wrote:
From what I understand, for these objects (calendar, calculator, tree, etc.) to drop down in the "correct" way, they shouldn't be forms, but actually WS_POPUP windows that have the desktop as their parents. I'm imagining they should capture the mouse as soon as they drop down, report to their owner (textbox, or whatever dropped them down) and then release the mouse. Am I missing something? Is this the correct approach?

Forms are fine. You just have to set their style bits correctly.

WS_POPUP is out! You might think it should be used (as I once did), but when the WS_POPUP style is set, it causes the parent form's title bar to be "inactive" when the popup has focus. This would cause the user to be confused.

So here's the code to set the style bits:
//style
int nStyle = GetWindowLong(this.Handle, GWL_STYLE);  nStyle^=Win.User.WS_POPUP;
nStyle^=Win.User.WS_POPUPWINDOW;
SetWindowLong(Handle,GWL_STYLE,nStyle);
 
//extended style
int nExStyle = GetWindowLong(this.Handle, GWL_EXSTYLE);  
nExStyle|=WS_EX_PALETTEWINDOW;
SetWindowLong(Handle,GWL_EXSTYLE,nExStyle);



profoundwhispers wrote:
Problem number two. Is the following methodology right: I should define an interface (IPopupControl) and implement it with every desendant (like for instance: DropDownTreeView: TreeView, IPopupControl). The reason is then I should be able to assign any dropdown control to an owner, and then the owner would always call a method (like IPopupControl.Popup) because it will always be implemented. So in other words, the owner will always be accepting one object [object?] which is IPopupControl instead of a specific object (DropDownXXXX) according to what it wants to drop down. Then of course, every dropdown control will implement its own methods that are different, to report the data back to the owner control (most probably textbox).

That would be one way to do it, but then you would have to re-implement the basic popup code for each of them. Why not have a Popup class that they all derive from?


profoundwhispers wrote:
I would have to call some Windows APIs in this process I would imagine. What are the disadvantages?

Not any that I know of...


Ok, as far as closing the popup, here's how I do it:
With menus and combo dropdowns, you grab the mouse capture with SetCapture() when the mouse is outside your menu, and release the capture with ReleaseCapture() when the mouse is inside your menu (so that any contained controls can get mouse messages). Close the popup when a MouseUp event is recieved and the mouse coordinates are outside of the form's bounds. You will also want to close the popup when it recieves a WM_APPACTIVATE message where the app being activated is not your own.


"Blessed are the peacemakers, for they shall be called sons of God." - Jesus

"You must be the change you wish to see in the world." - Mahatma Gandhi







Generaldll references Pin
pseudonym6712-Sep-03 22:19
pseudonym6712-Sep-03 22:19 
GeneralRe: dll references Pin
Arjan Einbu12-Sep-03 23:07
Arjan Einbu12-Sep-03 23:07 
GeneralRe: dll references Pin
dbetting13-Sep-03 15:36
dbetting13-Sep-03 15:36 
GeneralDLL wrapper and structs Pin
pithhelmet12-Sep-03 14:10
pithhelmet12-Sep-03 14:10 
GeneralRe: DLL wrapper and structs Pin
Tym!15-Sep-03 6:48
Tym!15-Sep-03 6:48 
GeneralException from HRESULT: 0x800A01C9 Pin
ajkumar12-Sep-03 14:09
ajkumar12-Sep-03 14:09 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
leppie12-Sep-03 14:44
leppie12-Sep-03 14:44 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
ajkumar12-Sep-03 15:52
ajkumar12-Sep-03 15:52 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
leppie12-Sep-03 16:10
leppie12-Sep-03 16:10 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
J. Dunlap12-Sep-03 15:05
J. Dunlap12-Sep-03 15:05 
GeneralRe: Exception from HRESULT: 0x800A01C9 Pin
ajkumar14-Sep-03 6:17
ajkumar14-Sep-03 6:17 
General#dev 0.97 released Pin
leppie12-Sep-03 10:59
leppie12-Sep-03 10:59 
GeneralRe: #dev 0.97 released Pin
J. Dunlap12-Sep-03 13:55
J. Dunlap12-Sep-03 13:55 
GeneralRe: #dev 0.97 released Pin
leppie12-Sep-03 14:41
leppie12-Sep-03 14:41 
GeneralI would like to refine an array. Pin
mcgahanfl12-Sep-03 9:42
mcgahanfl12-Sep-03 9:42 
GeneralRe: I would like to refine an array. Pin
Ernesto Perales Soto12-Sep-03 13:18
Ernesto Perales Soto12-Sep-03 13:18 
GeneralRe: I would like to refine an array. Pin
Nnamdi Onyeyiri13-Sep-03 1:24
Nnamdi Onyeyiri13-Sep-03 1:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.