Hi Nic,
I’m glad that you are playing with the extensions. They really show the flexibility of Wisej.
In general, when adding a control or a property to a control you are dealing with 3 aspects: 1) client side in javscript; 2) server side in .NET; 3) designer. Fortunately you can use all the Visual Studio designer features and Wisej connects the client with server so you can focus the programming to very clear responsibilities.
In this case you are looking at adding an array of objects. You can create a .NET class CustomSector with the properties Lo, Hi and Color. Capitalize the first character to be consistent with .NET names. Make the CustomSector class implement IWisejSerializable to set the CamelCase option to true (we should probably make this the default – it’s already the default for enumerations).
The Lo, Hi, and Color properties can be simple {get; set;} and can declare any of the designer specific attributes if needed.
This is the simple IWisejSerializable implementation to turn on camel casing:
#region IWisejSerializable
// Serialize using camel case to be javascript compatible.
bool IWisejSerializable.CamelCase { get { return true; } }
string[] IWisejSerializable.IgnoreList { get { return null; } }
bool IWisejSerializable.Serialize(TextWriter writer, WisejSerializerOptions options) { return false; }
#endregion
Once you have the CustomSector class, add a property to the control like this:
[DefaultValue(null)]
[MergableProperty(false)]
[TypeConverter(typeof(ArrayConverter))]
[Editor("System.ComponentModel.Design.ArrayEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public CustomSector[] CustomSectors
{
get;
set;
}
Now you have the property and you need to send it back to the client. JustGage is one of the three ways we have to implement a Wisej control and it’s the most integrated since it actually creates a javascript class “wisej.web.ext.JustGage”.
In JustGage.OnWebRender, add:
config.customSectors = this.CustomSectors;
You also have to add a corresponding property to the javascript side, in wisej.web.ext.JustGage.js inside the properties: {} block add:
customSectors: {init: null, check:”Array”},
Then in __createJustGageElement, add the property to the config object:
var config = {
id: elementId,
value: this.getValue(),
min: this.getMinimum(),
max: this.getMaximum(),
showMinMax: showLabels,
title: showTitle ? this.getTitle() : " ",
customSectors: this.getCustomSectors(),
label: showLabels ? this.getLabel() : " ",
titleFontColor: this.__resolveColor(this.getTextColor()),
labelFontColor: this.__resolveColor(this.getLabelColor()),
gaugeColor: this.__resolveColor(this.getBackgroundColor()),
};
This should be all.
If you want the new CustomSectors propery to update the widget when it’s changed, modify the property to this:
[DefaultValue(null)]
[MergableProperty(false)]
[TypeConverter(typeof(ArrayConverter))]
[Editor("System.ComponentModel.Design.ArrayEditor, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
public CustomSector[] CustomSectors
{
get
{
return this._customSectors.
}
set
{
this._customSectors = value;
Update();
}
}
private CustomSector[] _customSectors;
Otherwise you can call justGage1.Update() after changing the custom sectors. If you change only a property of an existing CustomSector array element you still need to call Update(). Unless you connect the CustomSector instanced to the owner and call Update from the property setters in there. This is mostly Visual Studio .NET designer and component model coding and not specific for Wisej. HTH. If you need more help, send me the project you have extended. And if you want to, we can incorporate it and publish the updated JastGage that you have done. Best, Luca
So it does – my bad. I should have looked.
Nic
It’s enhancement WJ-7387. Will probably be in the next update.
It should already include it. This is the initialization of the features map from the client passed in together with the first load request.
var data = {
hash: location.hash.substr(1),
browserSize: this.browserSize,
screenSize: { width: screen.width, height: screen.height },
os: this.platform.getSystemName(),
device: this.platform.getDeviceType(),
browser: this.platform.getBrowserName(),
version: this.platform.getBrowserVersion(),
fullScreen: window.fullScreenApi ? window.fullScreenApi.isFullScreen() : false,
features: {
webSocket: ("WebSocket" in window),
arrayBuffer: ("ArrayBuffer" in window),
notification: ("Notification" in window),
geolocation: ("geolocation" in navigator),
localStorage: ("Storage" in window),
speechSynthesis: (window.speechSynthesis) != null,
fullScreen: window.fullScreenApi ? window.fullScreenApi.supportsFullScreen : false,
speechRecognition: (window.speechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition) != null,
},
language: language
};
You are right! Logged as WJ-7386. Looks like the framework returns a PNG instead of a GIF.
Thanks. It’s caused by the grid trying to read the coordinates of the cell after the columns have been deleted. Logged as WJ-7385. Fixed in an interim build already.
Hi Frank,
Firstly, thanks for the quick reply, appreciated.
I have run your test project and of course it works fine, the difference is I think they way I was assigning the image. There seems to be a sublte difference between:
pictureBox1.Image = global::TestAnimatedGIF.Properties.Resources._36DVbRG;
and
pictureBox1.ImageSource = “36DVbRG.gif”;
Where 36DVbRG.gif is the GIF file that I couldn’t get to work. But it does work using .ImageSource and not if using .Image
Perhaps this is a bug, or perhaps I shouldn’t using the .Image property?
Hope this help,
Mark
Thanks Luca.
The big problem was fixing the “other” buttons. Believe or not, I had to define Active before Hovered to get everything working as it should.
I attach the result of my efforts.
Hi Mark,
first of all, thanks for your kind words about Wisej.
I have quickly build a simple sample trying to reproduce the issue you described,
but my sample appears to work fine (see attachment).
Can you please test it on your side and also share a few more infos about your setup
(browser, OS).
Thanks in advance !
Best regards
Frank
You need to change the activeCaption color?
If yes, this is what you need to do with the ThemeBuilder. For the Close Button:
The other buttons are the same but the hovered color is different.
Hi Cris,
Download(Stream) has been added in Wisej build 1.2.14 (as logged in WJ-7380)
Best regards
Frank
Hi Nic,
issue WJ-7368 is fixed in Wisej build 1.2.14.
Best regards
Frank
Hi Nic,
WJ-7381 is resolved in build 1.2.14.
Best regards
Frank
Hi Nic,
this regression and also the problem with the pointer on disabled buttons (WJ-7379) have been fixed in 1.2.14.
Best regards
Frank
A new build (1.2.14) with the following fixes/additions has been uploaded:
| Item | Type | Priority | Severity | Title | Resolution |
| WJ-7368 | Bug | Low | Trivial | Showing a form with window.ShowDialog does not focus its first control | Complete |
| WJ-7379 | Bug | Low | Trivial | Disable pointer on diabled buttons. | Complete |
| WJ-7380 | Enhancement | Low | Trivial | Add Application.Download(Stream). | Complete |
| WJ-7381 | Regression | High | Major | Controls dropped on a tab control page are not visible at design time. | Complete |
And the reason was an incomplete check in.
Frank can reproduce and now I can. Weird, earlier I had the same identical test and it was working fine. I must have been loading a previous build since this is a regression and very easy to reproduce…
Luca,
Sorry yes I managed to completely screw up the upload. I’ve tried again – apologies.
Basically its a form with two buttons. Pressing the first should enable the second. On my machine I see the message box but button 2 remains disabled.
Nic
Hi Nic,
this seems to be a regression. It´s logged as WJ-7381 and will be fixed in the next release.
Thanks for reporting it.
Best regards
Frank
Hi Nic,
The attached test project seems to be an empty window with a checkbox.
Best,
Luca
