Hi Tim, here are the answers:
https://wisej.com/support/question/how-to-load-the-a-third-part-control-css-file
https://docs.wisej.com/extensions/
2. Yes. We will have Maps extension supporting Google and Bing maps. But you can refer to point 1 above if you’d like to add it yourself.
3. We don’t use ASP.NET session and there is no Http context available usually since Wisej runs mostly using WebSocket. You can store any session info in Application.Session: See https://docs.wisej.com/docs/controls/general/application#session-object. You can either save each value, or save an object that you use in your app with as many fields as you need.
HTH
Best,
Luca
Hello Tung,
The issue is that the asynchronous handler in Wisej doesn’t require the AspNet session – it can handle simultaneous requests really really fast.
You can add this class to your app to require the AspNet session to be created:
namespace Wisej.Core
{
public class HttpHandlerRequiresSession : Wisej.Core.HttpHandler, System.Web.SessionState.IRequiresSessionState
{
// no code required.
}
}
Then modify your Web.config file like this:
<add name="wisej" verb="*" path="*.wx" type="Wisej.Core.HttpHandlerRequiresSession, [Assembly Name]"/>
Now all Wisej HTTP requests can use HttpContext.Current.Session.
Notice that I bolded HTTP. That’s because the traditional AspNet session cannot possibly work with WebSocket requests. But you can solve this in two alternative ways:
Application.Session.AspNetSession = HttpContext.Current.Session;
It saves the AspNet session with the Wisej session, which works with WebSocket.
Solution 1 works with the AspNet code that you mentioned. Solution 2 won’t work since HttpContext.Current.Session for those library will always be null on a WebSocket call.
HTH
Best,
Luca
Hello Gunter,
The ListView doesn’t have the SelectedIndex property (we should probably add it – it’s not in WinForms either) and the SelectedIndices and SelectedItems are read-only collections by design.
To select an item programmatically use the Selected property of the item: this.listView.Items[10].Selected = true. Look also at the SelectionMode and MultiSelect properties on the ListView. https://docs.wisej.com/api/wisej.web/lists-and-grids/listview
See https://msdn.microsoft.com/en-us/library/y4x56c0b(v=vs.110).aspx (you don need to set .Focused = true, use only .Selected = true)
HTH
Best,
Luca
Hello Michael,
You can place any html and javascript (and ASPNET) code in Default.html or Default.aspx. The javascript code can interact with the Wisej app. See https://docs.wisej.com/docs/concepts/javascript-object-model. Also the code behind in ASPNET can use the server side Wisej controls through the Application instance.
Javascript invoked from the server can use anything on the page. The html that you add manually is mixed with the html generated by Wisej widgets.
I tried the same as you and it worked:
<div id="test">Hello</div>
button1_Click(object sender, EventArgs e) {
Eval("alert(document.getElementById('test').innerHTML)");
}
You can verify the html using F12.
If by Desktop you are referring to the Wisej.Web.Desktop component, it’s different. The desktop component is a Wisej container and support background wallpaper images. You can place HTML in there too if you add an HtmlPanel. You can also use Bing’s beautiful current image rotation by adding the Bing Wallpaper extension, see https://wisej.com/extensions.
Best,
Luca
Hi Michael,
See answers below. If you tell me what you need to do I may be able to give more accurate answers.
Application.Desktop.Controls.Add(new HtmlPanel()
{
Dock = DockStyle.Fill,
Html = "<div style='background-color:yellow'>Hello</div>",
BackColor = Color.White
});
2. Yes you can manipulate Wisej widgets from JavaScript. See https://docs.wisej.com/docs/concepts/javascript-object-model
There is a whole object model and large methods to use. The code you posted is trying to alter an html element, not a javascript control. When you use Call() or Eval() the JavaScript code is executed in context so you can do Call(“hide”) or Eval(“this.hide()”). However, there is no reason to do that since the control already has Hide() and Show() and if you call the methods on the client, Wisej will update the server back.
Best,
Luca
You can use Application.ApplicationRefresh event https://docs.wisej.com/api/wisej.web/general/application#applicationrefresh
We have the JavaScript extender that executes the javascript at the right time and works with refreshes as well. When you drop the extender on a container it adds the JavaScript and JavaScriptSource properties to all controls.
HTH
Best,
Luca
Hi Michael,
You don’t need to change the locale on the thread. Wisej takes care of that, see:
https://docs.wisej.com/docs/concepts/localization
https://docs.wisej.com/docs/concepts/configuration
Best,
Luca
Hi Rui,
In two ways:
Best,
Luca
Use System.IO and Application.StartupPath.
See attached sample. Shows how to add javascript to any control and how to call back the server from the client.
It’s very simple. Open the page in design mode, select the button and in the property grid you will find two new properties (added when dropping the JavaScript extender from the toolbox) JavaScript and JavaScriptSource. They are the same, one allows you to edit the javascript in place, the other lets you select a js file.
The code in the same is like this:
this.addListener("click", function(){
alert(\"Hello from JavaScript!\");
App.MainPage.CallbackTheServer("Hello from JavaScript!");
});
You can find the list of events here: http://www.qooxdoo.org/current/apiviewer/#qx
And more help here: https://docs.wisej.com/docs/controls/extenders/javascript and here: https://docs.wisej.com/docs/concepts/javascript-object-model
Best,
Luca
Use the regular System.IO classes: Path.Combine(Application.StartupPath, “MyFiles”);
The application path is Application.StartupPath. You also have StartupUri, ExecutablePath, etc.: https://docs.wisej.com/api/wisej.web/general/application
/Luca
Hi David,
ProcessCmdKey is already supported in Wisej. However, there is a subset of events that Wisej doesn’t wire back to the server unless there is a handler attach and the keyboard events are all part of that list, otherwise the client would have to always generate a server event when pressing anything on the keyboard.
We call them “lazy events”: https://docs.wisej.com/docs/controls/general/lazy-events
So, to be able to override ProcessCmdKey all you need to do it to attach to any keyboard event: this.KeyDown += this.OnKeyDown;
There is a limit to what you can do when pre-processing a keyboard or mouse event. Consider that the event has already occurred and has been fully processed in the browser. All wisej event are asynchronous – as they should be since synchronous ajax has been deprecated long ago and it’s a bad idea in a web app.
Wisej also follows the full bubbling of the native browser events, so you can process keyboard and mouse events at the parent level.
We are unable to add IMessageFilter since it takes a Message argument and we’d have to convert events to windows sdk message codes, etc.
If you send a small app showing the key features you need we can better asses what to add and what’s already supported.
Best,
Luca
Hi Wilfred,
When form.ShowDialog(); of DialogWindow.cs is hit, it halts execution of the code below the
DialogWindow.Show("something");.
In effect, nothing is loaded in the datagridview until after the DialogWindow is closed.
I suggest you populate the datagridview in Load event of your main window.
Please refer to https://docs.wisej.com/docs/concepts/modal-dialogs.
Hope this helps
Hi Jorge
A.- For more details about theme editor, you can get it in the online guide. Click on the yellow icon at right of version number
https://docs.wisej.com/theme-builder/
B.- For create your custom icons, I suggest that export all icons from one theme and edit it with and vector app, like inkscape
After create your icons, import them to the theme for replace that you want
You can use custom names, but be carefully in replace in other sections of the theme file were was used the prior name
C.- For setting margins of one icon, see the images adjunct
In Dev time you can’t set properties of the theme, just use the resources like icons, to assign them to a element, like a button or item menu
Regards and happy code
Hi Takao,
There are a few different ways you can do this from the client.
You can use fireWidgetEvent:
this.fireWidgetEvent("eventName", {any: "data"});
You can then handle it in Widget.WidgetEvent on the server.
You can also use fireDataEvent:
this.fireDataEvent("eventName", {any: "data"});
You’ll need to override the OnWebRender and OnWebEvent method in your Widget class (see attached project).
The important thing to note is that you need to retain the context of the client-side widget when you’re trying to use fireWidgetEvent or fireDataEvent.
For more info on events in Wisej, read this: https://docs.wisej.com/docs/controls/general/lazy-events.
I attached your project modified to use fireDataEvent. All it does right now is fires an event when the hour or minute changes to update HourValue and MinuteValue.
You can also use Call or Eval if you specify a function in the client-side widget’s context (see the attached sample).
Here is a little information on it: https://docs.wisej.com/docs/concepts/javascript
If you have any questions about it, please let me know.
Best,
Levie
As long as the Window or Page is created in Program.Main you’ll be able to access it using App.MainPage or App.Window1
If your audio and button are on the same level, you can use this so you don’t have to worry if it’s on a page or window:
this.getParent().audio1.play();
I would recommend using the debugger; keyword and placing it in your JavaScript code so you can play around with the console in Chrome Dev tools.
Some helpful links:
JavaScript Object Model in Wisej:
https://docs.wisej.com/docs/concepts/javascript-object-model
Debugger keyword:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/debugger
HTH,
Levie
For the DataGridViewCheckBoxColumn use the TrueValue and FalseValue properties.
dataGridView.Columns.Add(new DataGridViewCheckBoxColumn() {
TrueValue = "Y",
FalseValue = "N",
});
For the CheckBox use the Parse and Format events like this:
private void Binding_Format(object sender, ConvertEventArgs e)
{
e.Value = Object.Equals(e.Value, "Y");
}
private void Binding_Parse(object sender, ConvertEventArgs e)
{
e.Value = (Object.Equals(e.Value, true) ? "Y" : "N");
}
Note: Attach the event handler before adding the binding object.
Hi Ewan,
Wisej offers the User and UserIdentity Properties.
Application.User returns IPrincipal and Application.UserIdentity returns WindowsIdentity class.
Here are a couple of links that might help you:
Application.User Property (wisej.com)
Application.UserIdentity Property (wisej.com)
IPrincipal Interface (System.Security.Principal) | Microsoft Docs
WindowsIdentity Class (System.Security.Principal) | Microsoft Docs
Best regards,
Alaa
When you set the RowHeight that’s the height, you’d have to add the padding. Otherwise you can add internal padding in the theme or a theme mixin.
You can draw in any cell using the CellPaint event. It fires for cells that have the UserPaint property set to true.
The Padding property of the TabPage is for the padding of the TabPage, which is the container where you drop controls that go inside the TabPage. To set the size of the button use ItemSize. To change how the automatic side of the button is calculated use the SizeMode property.
