Solved

ActiveX Properties (Drop-down List)

Posted on 1998-04-20
6
209 Views
Last Modified: 2010-04-10
I am using Microsoft Visual C++ 5.0 Professional Edition.  I have created an ActiveX control to display shadowed, curved, blocked, and other styles of text.  One property for the control is the 'Style' property.  Right now, the style property is just a 'short' that, if you enter a value which is out of range, will display a message box to notify you of what the range is and what each number does.  Now, when I look at Visual Basic OCX controls (also known as ActiveX controls) I have noticed that properties like 'MousePointer' display a drop-down list that the user is then able to select a number from, instead of typing it in themselves.

I would like to know how to invoke one of these drop-down lists in the property box and I would appreciate the sample code needed to do this.  The property I am dealing with is called, simply, 'Style', and the variable attached to it is 'm_style'.

Thanks in advance...
0
Comment
Question by:Egore
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 1

Expert Comment

by:guruprasad031298
ID: 1162401
The answer to your requirement is to use 'Property pages'. It is explained in good detail in MSVC 5.0 online help.

Browse 'Developer Products' -> 'Visual C++' -> 'Visual C++ tutorials' -> 'Circle : ActiveX Control' -> 'Modifying the default property page'.

The tutorial explains everything in an understandable language and is easy to implement.

As a short suggestion, do this, Place a drop-down combo in your default propety page. Display valid short values of m_Style in the list box of the combo and link m_Style to this combo and you should be on your way.

FYI, Microsoft requires all UI based ActiveX control to have property pages.
0
 
LVL 3

Author Comment

by:Egore
ID: 1162402
I already know how to create property pages, and I have created them.  What I want is for, when I open up Visual Basic, if I DO NOT use click on 'Custom', I still want the property to have a drop-down list.  This is rather hard to understand, but, if you have VB, just look at the 'MousePointer' property, and you will see what I mean.
0
 

Accepted Solution

by:
bleibold earned 100 total points
ID: 1162403


Egore,

Create an enumeration called TEXTStyles in the ODL as shown below.

typedef [v1_enum] enum
{      
      STYLE_SHADOW      = 0x1,
      STYLE_CURVED      = 0x2,
      STYLE_BLOCKED      = 0x4      
} TEXTStyles;

[id(2)] TEXTStyles Style;

Change the property's data type from long to TEXTStyles in the interface:

This then should show up as a property list in VB.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:Egore
ID: 1162404
If this works, I will still need to be able to display text as well in this list.  Like I said, look at the MousePointer property in VB, it has a number, a hyphen (-) and then some text.  I need to be able to do this kind of thing.  If you can show me how to add text to this, then I will give you the points.
0
 

Expert Comment

by:bleibold
ID: 1162405
Egore,

The actual named enumeration STYLE_SHADOW with ID of 0x1 will show up in the VB property browser as 1 - STYLE_SHADOW and so forth for other named enumerations using the technique above.  You can modify the enumeration name to something more readable to the user.

Bill
0
 
LVL 3

Author Comment

by:Egore
ID: 1162406
I tried putting these lines of code in my .ODL file and I got a compiler error.  However, it wouldn't tell me where the error occurred, so I'm going to need a little more specific information.

1.)  Will you tell me what lines of code to insert your code between?
2.)  Will I have to use the ClassWizard to chage the variable type or will I have to do that directly in code?
3.)  Will I have to change any existing code to make it compatible with this new typedef?

If I have to change anything, please tell me what I need to change.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question