All Answers

0 votes

Hi Tim, here are the answers:

  1. Yes you can. There are several ways (about 3) of doing it. See:

https://wisej.com/support/question/how-to-load-the-a-third-part-control-css-file

https://docs.wisej.com/extensions/

https://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

 

  • Luca answered Nov 2, 2016 - 2:21 pm
  • last active Oct 2, 2021 - 9:51 pm
0 votes

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:

  1. Disable WebSocket: add “enableWebSocket”: false to your Default.json. See https://docs.wisej.com/docs/concepts/configuration
  2.  Keep WebSocket enabled and in your Program.Main() add this:
           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

  • Luca answered Nov 2, 2016 - 8:13 pm
  • last active Oct 2, 2021 - 9:47 pm
0 votes

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

  • Luca answered Nov 4, 2016 - 3:30 pm
  • last active Oct 2, 2021 - 9:46 pm
0 votes

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

  • Luca answered Nov 6, 2016 - 1:53 pm
  • last active Oct 2, 2021 - 9:45 pm
0 votes

Hi Michael,

See answers below. If you tell me what you need to do I may be able to give more accurate answers.

  1. The HtmlPanel is sized as any other panel. The html is sized depending on the content in order to be able to scroll the overflow. I tried the follow code and it works well. However, you cannot fill the part below the task bar by design, since the workspace is on top of the taskbar, otherwise windows would maximize below. The Desktop already has a Wallpaper property to change the wallpaper, which is also themeable, and it has an extension with source code able to pull in images from Bing.
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

  • Luca answered Nov 8, 2016 - 7:44 pm
  • last active Oct 2, 2021 - 9:44 pm
0 votes

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

  • Luca answered Nov 10, 2016 - 12:07 am
  • last active Oct 2, 2021 - 9:43 pm
0 votes

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

  • Luca answered Nov 15, 2016 - 3:09 pm
  • last active Oct 2, 2021 - 9:39 pm
0 votes
In reply to: [SOLVED] URL arguments

Hi Rui,

In two ways:

Best,

Luca

  • Luca answered Nov 15, 2016 - 3:28 pm
  • last active Oct 2, 2021 - 9:38 pm
0 votes

Use System.IO and Application.StartupPath.

  • Luca answered Nov 17, 2016 - 2:28 pm
  • last active Oct 2, 2021 - 9:35 pm
0 votes

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

 

  • Luca answered Nov 23, 2016 - 8:42 pm
  • last active Oct 2, 2021 - 9:34 pm
0 votes

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

  • Luca answered Nov 23, 2016 - 8:45 pm
  • last active Oct 2, 2021 - 9:26 pm
0 votes

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

  • Luca answered Nov 25, 2016 - 5:31 pm
  • last active Oct 2, 2021 - 9:25 pm
0 votes

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

  • Cris answered Nov 29, 2016 - 1:49 pm
  • last active Oct 2, 2021 - 9:23 pm
0 votes
In reply to: [SOLVED] Menu shaping

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

 

  • Paul answered Mar 31, 2020 - 11:29 pm
  • last active Oct 2, 2021 - 9:21 pm
0 votes

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

  • Levie (ITG) answered Feb 12, 2021 - 4:12 pm
  • last active Oct 2, 2021 - 9:18 pm
0 votes

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

  • Levie (ITG) answered Mar 26, 2021 - 5:57 pm
  • last active Oct 2, 2021 - 9:16 pm
0 votes

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.

 

  • Luca answered May 2, 2021 - 8:27 pm
  • last active Oct 2, 2021 - 7:27 pm
0 votes

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

  • Alaa (ITG) answered May 13, 2021 - 5:01 pm
  • last active Oct 2, 2021 - 7:25 pm
0 votes

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.

  • Luca answered Jun 18, 2021 - 3:33 pm
  • last active Oct 2, 2021 - 7:23 pm
0 votes
In reply to: Padding on Tabpages

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.

  • Luca answered Sep 5, 2021 - 5:44 pm
  • last active Oct 2, 2021 - 7:21 pm
Showing 3281 - 3300 of 11k results