473,770 Members | 4,443 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Have there been changes to Type Editors in .NET 2?

Hi

I've just upgraded some Type Editors from 1.1 to 2.0 and whilst they compile
OK, I'm not getting any results in the test harness PropertyGrid. Usually
when you select a particular property, the ellipsis appears at the end of the
cell and this is not heppening.

I was therefore wondering if there had been changes in TypeEditors between
..NET versions 1.1 and 2.0 that I hadn't hear about.

One of the Type Editors is shown below:

Imports System.Windows. Forms
Imports System.Drawing. Design
Imports System.Componen tModel

Public Class UIFilenameEdito r
Inherits System.Drawing. Design.UITypeEd itor
'@ <summary>Open s the dialogue in a modal window</summary>
'@ <remarks>
'@ <para>Since it is natural for the filename editor to open a file
dialogue which is a modal window, this editor is set to have Modal
style.</para>
'@ <para>This method seems to called when the cursor lands on a property
grid entry.</para>
'@ </remarks>
'@ <param name="context" type="Component Model.ITypeDesc riptorContext">
'@ <para>The context is a
System.Windows. Forms.PropertyG ridInternal.Pro pertyGridDescri ptorGridEntry.</para>
'@ </param>
'@ <returns>Return s the 'style' to the calling property grid (or other
control)</returns>
Public Overloads Overrides Function GetEditStyle(By Val context As
ITypeDescriptor Context) As UITypeEditorEdi tStyle
If Not context Is Nothing AndAlso Not context.Instanc e Is Nothing Then
Return UITypeEditorEdi tStyle.Modal
'
End If
Return UITypeEditorEdi tStyle.None
End Function
'@ <summary>Thid core method provides the file dialogue
interface.</summary>
'@ <returns>The file name that has been selected.</returns>
<RefreshPropert ies(RefreshProp erties.All)> _
Public Overloads Overrides Function EditValue(ByVal context As
ITypeDescriptor Context, ByVal provider As System.IService Provider, ByVal
value As Object) As Object

If context Is Nothing OrElse provider Is Nothing OrElse
context.Instanc e Is Nothing Then
Return MyBase.EditValu e(provider, value)
End If

Dim objFileDialogue As FileDialog

If context.Propert yDescriptor.Att ributes(GetType (SaveFileAttrib ute))
Is Nothing Then
objFileDialogue = New OpenFileDialog
Else
objFileDialogue = New SaveFileDialog
End If

objFileDialogue .Title = "Select " &
context.Propert yDescriptor.Dis playName
objFileDialogue .FileName = DirectCast(valu e, String)

Dim objFileDialogue FilterAttribute As FileDialogueFil terAttribute =
DirectCast(cont ext.PropertyDes criptor.Attribu tes(GetType(Fil eDialogueFilter Attribute)), FileDialogueFil terAttribute)

If Not objFileDialogue FilterAttribute Is Nothing Then
objFileDialogue .Filter = objFileDialogue FilterAttribute .Filter
End If

Dim objFileDialogue CaptionAttribut e As FileDialogueCap tion =
DirectCast(cont ext.PropertyDes criptor.Attribu tes(GetType(Fil eDialogueCaptio n)), FileDialogueCap tion)

If Not objFileDialogue CaptionAttribut e Is Nothing Then
objFileDialogue .Title = objFileDialogue CaptionAttribut e.stuTitle
End If

If objFileDialogue .ShowDialog() = DialogResult.OK Then
value = objFileDialogue .FileName
End If

objFileDialogue .Dispose()

Return value
End Function
'@ <summary>An attribute class within UIFilenameEdito r that sets the
filter on the file dialogue.</summary>
<AttributeUsage (AttributeTarge ts.Property)> _
Public Class FileDialogueFil terAttribute
Inherits Attribute
Private _stuFilter As String

'@ <summary>The filter to use in the file dialog in
UIFilenameEdito r.</summary>
'@ <remarks>The following is an example of a stuFilter string: "Text
files (*.txt)|*.txt|A ll files (*.*)|*.*"</remarks>
Public ReadOnly Property Filter() As String
Get
Return _stuFilter
End Get
End Property

'@ <summary>Defi ne a Filter for the UIFilenameEdito r.</summary>
'@ <param name="stuFilter ">The filter string to use in the file
dialog in UIFilenameEdito r. The following is an example of a filter string:
"Text files (*.txt)|*.txt|A ll files (*.*)|*.*"</param>
Public Sub New(ByVal stuFilter As String)
MyBase.New()
_stuFilter = stuFilter
End Sub
End Class

'@ <summary>An attribute class within UIFilenameEdito r that, if present,
changes the <i>open file dialogue</i> to a <i>save file dialogue</i>
control</summary>
<AttributeUsage (AttributeTarge ts.Property)> _
Public Class SaveFileAttribu te
Inherits Attribute
End Class

'@ <summary>An attribute that sets the caption on the file dialogue
box</summary>
<AttributeUsage (AttributeTarge ts.Property)> _
Public Class FileDialogueCap tion
Inherits Attribute

Private _stuCaption As String

'@ <param name="stuTitle" >The string that will be placed in the
title bar of the dialogue</param>
Public Sub New(ByVal stuTitle As String)
_stuCaption = stuTitle
End Sub

Public ReadOnly Property stuTitle() As String
Get
Return _stuCaption
End Get
End Property

End Class
End Class

I created a test class to exercise each of the Type Editors that I've
written. The corresponding property in the test class is:

Private _stuFilename As String

<Category("Fi le editors"), EditorAttribute (GetType(UIFile nameEditor),
GetType(UITypeE ditor)), UIFilenameEdito r.FileDialogueF ilter("HTML
files|*.htm"), UIFilenameEdito r.FileDialogueC aption("Select an HTML file")> _
Public Property stuFilename() As String
Get
Return _stuFilename
End Get
Set(ByVal stuFilename As String)
_stuFilename = stuFilename
End Set
End Property
Any clues anyone?

Thanks in advance.

Crispin

Bristol, UK.
Jun 18 '06 #1
0 1683

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1789
by: Alessandro Crugnola *sephiroth* | last post by:
Hi, i'm using wxPython and wxTextStyled. How can I intercept document changes for active documents (for example modified with others external editors)? thanks in advance -- Alessandro Crugnola Flash | PHP Developer http://www.sephiroth.it
5
1927
by: bittercold | last post by:
Hi, guys, I need to overload global "new" operator but I have to know the type id "new" is begin invoked on. For example if I overload it like this void *operator new(size_t n) { ...body... }
4
3433
by: frogman042 | last post by:
My daughter is playing around trying to learn JavaScript and she wrote a small program that prints out a message in increasing and decreasing font size and color changes. She is using document write and it works fine until she puts it into a function and then calls the function from a button with onClick. This also seems to work OK, with the exception that the page is cleared, and the curser changes (and stays) as an hourglass. In...
21
2022
by: windandwaves | last post by:
Hi Folk Right now, I am using notepad2 to edit my PHP files. Do you have any recommendations for any php editors I should purchase instead? I dont mind spending some money for a good product. I also have visual studio and I hear that there is an extension for VS for php. Does anyone have any experience with this? TIA
0
1080
by: Lars Eighner | last post by:
Follow up in comp.editors The followup to this message (in comp.editors) contains the whole version 1.0 distrution of Type HTML Macros for JOE. This is a flat ASCII document, but it runs to nearly 5000 lines, so if you wish to avoid it, don't open it. --
28
2440
by: rich | last post by:
i know that there are die hard mark uppers that use notepad or some other plain editors...as far as graphic editors are concerned what are some reccomendations both commercial and if any freeware
9
3191
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will load with different data (locations, departments, etc.).
13
1559
by: so many sites so little time | last post by:
say i want spacing in my text so instead of doing <br> <br> in between the lines or having to do <href = or <a href = for a link what could i do to have php enter to mysql or retrive it formated?
19
2446
by: zzw8206262001 | last post by:
Hi,I find a way to make javescript more like c++ or pyhon There is the sample code: function Father(self) //every contructor may have "self" argument { self=self?self:this; //every class may have this statement self.hello = function() {
0
9602
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10017
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3987
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.