Solved

ActiveX Properties (Drop-down List)

Posted on 1998-04-20
6
204 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
  • 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

772 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