|
lukeer wrote: But the DropDown list doesn't drop down any longer.
Did you decorate your property with the TypeConverter-attribute, pointing to your customized converter?
I are Troll
|
|
|
|
|
Yes, I did. And since then it is that the standard entry is being translated but the arrow button indicating a drop down list is missing.
I can get the arrow button back by decorating with an additional UITypeEditor. That UITypeEditor's GetEditStyle() method is to return UITypeEditorEditStyle.DropDown regardless of its context.
But it won't drop down anyways even with that arrow button visible.
And another dropdown, this one without TypeConverter doesn't drop down either. Since this sounds confusing even to me, maybe the following table can help:
| UITypeEditor | No UITypeEditor
-----------------+----------------------------------+-----------------------------
TypeConverter | Arrow Button without | No arrow button
| function | at all
-----------------|----------------------------------+-----------------------------
No TypeConverter | Arrow Button without | DropDown works, but
| function (Function can | without Translation
| be achieved by |
| UITypeEditor.GetEditStyle() |
| returning |
| UITypeEditorEditStyle.None) |
Can anyone please explain this behaviour?
Ciao,
luker
|
|
|
|
|
lukeer wrote: Yes, I did. And since then it is that the standard entry is being translated but the arrow button indicating a drop down list is missing.
Aight, we'll need some code. Can you post a short snippet that displays this behavior?
lukeer wrote: but the arrow button indicating a drop down list is missing.
Sounds like it recognizes the GetStandardValuesSupported (returning true, to indicate that the converter has a list with options to choose from) and not the GetStandardValues method that provides the actual list. If you post your converter here, we'll have a look
lukeer wrote: I can get the arrow button back by decorating with an additional UITypeEditor. That UITypeEditor's GetEditStyle() method is to return UITypeEditorEditStyle.DropDown regardless of its context.
I'd remove the code for the UITupeEditor and focus on the TypeConverter. You should be able to get a dropdown-list using the TypeConverter, if the TypeConverter can be found and the correct property is decorated.
lukeer wrote: And another dropdown, this one without TypeConverter doesn't drop down either.
That sounds logical; nor the UITypeEditor nor the TypeConverter can give it a list with values, hence a dropdown would always be empty.
In the meantime, you might want to check out the walkthrough on MSDN[^]. The second example sounds like what you're building, you might find something if you compare it with your own code.
I are Troll
|
|
|
|
|
Here is my TypeConverter code. As you will see neither GetStandardValuesSupported nor GetStandardValues are overridden yet. Would that be necessary?
public class TranslationTypeConverter : System.ComponentModel.TypeConverter
{
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (destinationType.Equals(typeof(string)))
return (true);
return base.CanConvertTo(context, destinationType);
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
if (destinationType.Equals(typeof(string)))
{
Type typeToConvert = context.PropertyDescriptor.PropertyType;
string tableName = typeToConvert.DeclaringType.FullName;
System.Resources.ResourceManager rm = new System.Resources.ResourceManager(tableName, typeToConvert.Assembly);
string key = typeToConvert.Name + "_" + value.ToString();
string convertedString = rm.GetString(key);
if (
convertedString == null
|| convertedString.Length <= 0
)
convertedString = value.ToString();
return (convertedString);
}
return base.ConvertTo(context, culture, value, destinationType);
}
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (sourceType.Equals(typeof(string)))
return (true);
return base.CanConvertFrom(context, sourceType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
return (base.ConvertFrom(context, culture, value));
}
}
Ciao,
luker
|
|
|
|
|
lukeer wrote: As you will see neither GetStandardValuesSupported nor GetStandardValues are overridden yet. Would that be necessary?
Yup. The first one explains that it has default values (should return 'true') and that it requires a dropdown-arrow to open the list with those default values. The second method should provide that list with values.
Without those methods, the typeconverter won't show a dropdownlist, as it doesn't know what to display
I are Troll
|
|
|
|
|
What I don't understand is that by not overriding GetStandardValuesSupported and GetStandardValues I suspect the base class to take care of them.
Why doesn't the base class make PropertyGrid show a drop down list while without applying my derived class at all it works?
Ciao,
luker
|
|
|
|
|
lukeer wrote: What I don't understand is that by not overriding GetStandardValuesSupported and GetStandardValues I suspect the base class to take care of them.
If you want a dropdownlist, you'll need to override them. Check the example on the MSDN-page that I linked.
lukeer wrote: Why doesn't the base class make PropertyGrid show a drop down list while without applying my derived class at all it works?
Because a property-grid is intelligent, and it knows that it should use an EnumConverter[^] if nothing is provided
I are Troll
|
|
|
|
|
Thanks a lot.
With overriding the following 6 methods
GetStandardValuesSupported()<br />
GetStandardValues()<br />
CanConvertFrom()<br />
ConvertFrom()<br />
CanConvertTo()<br />
ConvertTo()
everything works as expected.
Ciao,
luker
|
|
|
|
|
Folks
Engaging in a project as a newbie in soundscan, encountered problems while implementing this simple piece of code. It's my appreciation if you lead me through this dense un-documented forest by microsoft !!
P.S.1 : Please introduce me a cook-book or any useful tutorial or documentation in directsound what i couldn't find it anywhere!!!
P.S.2:You can also find the code here:http://www.4shared.com/get/j0J8g6wA/SSM-VBNET-DirectSound.html[^]
Tnx .
#Region "References"
Imports Microsoft.DirectX
Imports Microsoft.DirectX.DirectSound
Imports System.Threading
#End Region
Friend Class frm_main
...
#Region "Command Button"
Private Sub cmd_capture_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmd_capture.Click
Try
If Not devices_waveformat() Then Return
DSBuffer.Start(False)
Thread.Sleep((DSSamples / DSFrequency) * 1000)
'Containing Input Data
Dim DSArray As Array = DSBuffer.Read(0, Type.GetType("Integer"), LockFlag.FromWriteCursor, DSFormatArray)
DSBuffer.Stop()
Catch ex As Exception
Debug.WriteLine(ex.Message)
Debug.WriteLine(ex.ToString)
End Try
End Sub
#End Region
...
End Class
|
|
|
|
|
A quick internet search for this gave me over 25,000 hits.
If you cannot find anything in that lot to help you, how on earth do you expect anyone here to be able to?
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
Hello everyone.
Sorry for my english but it isn't my first language. I'm goint to try to explain the best as i can.
My Problem is:
I'm building a project using entity framework. The data base is generate by a edmx(database project). To implement business logic i use stored procedures, but i only con map the to parent entity funcions. I can't map stored procedures to an associated table.
Thanks
|
|
|
|
|
You might stand more chance of getting an answer if you ask this in the Database Forum[^].
If you do, point out that you have asked it here already but are asking there because I suggested that you should. (Otherwise someone might shout at you. )
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
I wouldn't let CG touch my Abacus!
When you're wrestling a gorilla, you don't stop when you're tired, you stop when the gorilla is.
|
|
|
|
|
|
I am trying to add the Application version (not the Installer version) to the
Welcome box using CustomActionData in VB.NET to create a variable in a field
such as /MY_CA="[MyCustomVersion]", but need to know how to extract and display
such a value at install time, ie where would the following line go?
Context.Properties.Item("MY_CA") = "Version 4002"
in order to populate the first line in the Welcome text property such as
"...will guide you through the installation of[ProductName] [MyCustomVersion]"
|
|
|
|
|
There is a debate going on at work right now. Basically we are going to be creating some new tier objects; for the sake of simplicity, just assume basic stuff like a business tier, data tier, etc). The business tier will have objects like a Orders object (that will return order info) a customer object (that will return customers), etc, etc.
Is it typical for someone to want to create tier objects as an executable vs. using .dlls? What would be the pros to using an executable in a tier instead of a .dll?
Also, can you pass back collections, datasets, etc from an .exe to another .exe? Admittedly, I've never tried.
The proposed architecture:
Client.exe
would call a tierobject.exe
would call a datalayer.dll
I can think of many reasons why I would think doing this would be a bad idea, but I am also trying to remain open-minded.
Thanks for any insights to the gurus out here.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
Your business model objects will be in a separate project. As an stand alone exe, it will have nothing to offer. No Main method, no UI etc. I see no point in making it an exe.
Jon_Boy wrote: Also, can you pass back collections, datasets, etc from an .exe to another .exe? Admittedly, I've never tried
Yes. If they are public or are returned by some public method yes. You will just need to add reference to that exe in calling project.
|
|
|
|
|
With .NET, you can use an EXE just like a DLL... So there's nothing stopping you from doing it this way.
Of course, there doesn't seem to be much of a point to it, in your situation.
I actually did something like that, but my situation was a bit different... It went something like this:
ScriptingInterface.exe
Application.exe
BusinessLayer.dll
...
For normal use, you would just run the Application.exe... But there were certain tasks, intended to run once a day or in special situations, that were located in the Application.exe (Though they mostly wrapped routines and models from the business layers). Initially, they were being triggered from menu options, but eventually we wanted to automate them by hooking them up to a scheduler...
So basically, the ScriptingInterface.exe would reference Application.exe, and use command line arguments to perform one of those menu-driven tasks, without actually opening up the GUI.
C:\> ScriptingInterface.exe Maintenance DailyRoutines RunSomething
translated to...
namespace My.Namespace.Maintenance
{
public static class DailyRoutines
{
public static void RunSomething()
{
}
}
}
So, there are scenarios where you might want to use an EXE like a library, but for a business layer? Probably no point.
|
|
|
|
|
Agreed with the comments above. Just wanted to get a feel for if I was way off base.
"There's no such thing as a stupid question, only stupid people." - Mr. Garrison
|
|
|
|
|
The only point i can see of making the different layers into exe's is if they're running as a service and you want to have one point (bottleneck?) of entry. This would naturally be the case if the client resides on one box while the server (tierobject) resides on another. That doesn't mean there won't be dlls involved for the interfaces between the layers though.
"If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams
|
|
|
|
|
Hi ! Firest, sorry for my bad english.
I try to create a simple 2D graph scene for learning purpose. A very great article from Bob Powel
(http://www.bobpowell.net/graphicsstack.aspx) who gave me a bese to start.
So, I understand that to draw an "objects chain" (like bones chain), I must start with an identity matrix and rotate/translate it with the local transform of the bone to draw. At the end of a chain, I reset my "drawing matrix" and I can draw others bones chains.
So, the Bone class only store a local matrix and the drawing method of my Renderer control only use this local transform to draw an object relatively from its parent.
All is good. I can modify and read the local translation or rotation for each bone easilly.
Now, my problem is, I want to be able to read/modify the absolute position or rotation of a nested object. The reason is simple.
Imagine I have a root bone with one child. The root bone have an absolute position (10, 10) and an absolute rotation of 45°. The child bone has a local translation of (30, 0) and a rotation of 45°. We can easilly say that this child bone has an absolute rotation of 90°. I can easilly compute the absolute transform from the local one.
So now I can get/set local transform and get absolute transform, but I can't find a way to set the absolute transform.
I understand I must translate an absolute matrix to a local matrix, but what could be the pseudo code or steps to achieve this ?
|
|
|
|
|
Are you aware of the Graphics.Transform property? and the Graphics.ResetTransform() method?
I'm not sure what your code organization is, I don't think I would need any of those when painting a hierarchical object: the root of the drawing should just get the original Graphic from the PaintEventArgs parameter, then adapt and pass on to its children, each of them undoing their transformation change when they are done.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Yes, I know Graphics.Transform / ResetTransform and Save / Restore
This is a pseudo code for my main drawing function ...
Private Sub MainDrawing
For each bone in bones list (bone class inherits TreeNode.)
-Save the Graphics tranform (Graphics.Save)
-Call a recursive function (DrawBonesRecursively)
->DrawBonesRecursively(e.Graphics, bone)
-Restore the original Graphics tranform (Graphics.Restore)
End For
End Sub
Private Sub DrawBonesRecursively(g as Graphics,bone as Bone)
-Get the LOCAL matrix of the bone
-Rotate and Translate Graphics transform with LOCAL matrix values
-Get the untransformed GraphicsPath of my bone
-Draw it
For each childBone in bone.Nodes
-Call this sub itself for recursion. For "bone" argument, I pass "bone.
End For
End Sub
My drawing function only need the local coordinates of each bone. So, I can get/set easilly the LOCAL transform, and I'm only able to compute the absolute transform and read it, but if I want to set it with absolute values, I must convert it with local values to make my function drawing.
Do you understand my problem ? Sorry I'm not very comfortable with the kind of explanations in english
|
|
|
|
|
The transformations you get from ScaleTransform and the like are cumulative, so child bones get their parent's matrix automatically; you do need to add an undo, so just before End Sub insert
Undo Rotate and Translate Graphics transform with LOCAL matrix values
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Question:
My company has recently bought some fancy usercontrols on the net.
These controls can do a lot, but some of them require databinding.
This is something I am not familiar with and neither is my company.
I am quite convinced of the advantages of databinding, but not when it's done in the designer. The designer generates a lot of code, both in VB and SQL and puts lots of items in your toolbox and componentstray. Bottomline is that I have no idea what I'm doing in the designer. But this is also because I'm not familiar with creating datasets in the designer.
So what do you say? Should I just keep on trying and make my dataset, tables and binds in the designer or is programming the whole thing easier/more scalable/better maintainable etc.? What are the pro's and cons, code vs. designer.
|
|
|
|
|
IMHO, using the designer limits your options and creates a ton of "mystery" code that goes in places you're not aware of.
I never use the designers for datasets. I prefer to write my own code for simplicity and maintainability.
BTW: Databind is done all the time without using the deisgners. When you set a DataSource property to some collection or DataTable or DataSet, you're doing databinding. I can't believe nobody in your company knows about this.
|
|
|
|
|