User id on bottom line of Magic window.


Brendan Wheeler
 

Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 


Steven Burrows
 

No, I believe it is gone from runtime, although the XPA Help doesn’t specifically say it is or isn’t available.

We have put it on our background form.

 

 


Steven Burrows

 

 

From: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] On Behalf Of Bren607
Sent: 31 May 2017 15:17
To: main@magicu-l.groups.io
Subject: [magicu-l] User id on bottom line of Magic window.

 

Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 


Harry Kleinsmit
 

You could set it yourself using the StatusBarSetText(User(0)) function

Harry Kleinsmit.


On Wed, May 31, 2017 at 07:17 am, Bren607 wrote:
Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 

 


Heidi Schuppenhauer
 

I've heard of it being done using .Net objects. Actually you can add all kinds of things to the status bar, including a nice little green "progress bar". 

Heidi.Schuppenhauer


 

On Wed, May 31, 2017 at 7:17 AM, Bren607 <bren607@...> wrote:
Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 



Frederik Soete
 

Hi,

You can indeed add the username via some dot net snippet, e.g. like this, assuming a dot net invoke with the an expression of 'User(0)' as parameter:

using System;

using F = System.Windows.Forms;

 

public static class Snippet

{

      public static void func(System.String user)

      {

            var form = F.Form.ActiveForm;

            while (form != null && form.Parent != null) {

            form = form.Parent as F.Form;    

            }

            if (form != null) {

                  foreach (var ssc in form.Controls) {

                        if (ssc.GetType().ToString().Equals("com.magicsoftware.controls.MgStatusStrip")) {

                             var ss = (F.StatusStrip)ssc;

                             var ssi = new F.ToolStripStatusLabel(user);

                             ssi.BorderSides = F.ToolStripStatusLabelBorderSides.Left | F.ToolStripStatusLabelBorderSides.Top;

                             ss.Items.Insert(1, ssi);

                        }

                  }

            }

      }

}




Op 1 jun. 2017 03:07 schreef "Heidi Schuppenhauer" <heidis13@...>:

I've heard of it being done using .Net objects. Actually you can add all kinds of things to the status bar, including a nice little green "progress bar". 

Heidi.Schuppenhauer


 

On Wed, May 31, 2017 at 7:17 AM, Bren607 <bren607@...> wrote:
Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 



Florian Groothuis
 

We use this same thing, but it is not consistent. If you hover over the menu it disappears, clicking the main form it appears again.

 

Gr

Florian

 

Van: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] Namens harry@...
Verzonden: donderdag 1 juni 2017 0:31
Aan: main@magicu-l.groups.io
Onderwerp: Re: [magicu-l] User id on bottom line of Magic window.

 

You could set it yourself using the StatusBarSetText(User(0)) function

Harry Kleinsmit.

On Wed, May 31, 2017 at 07:17 am, Bren607 wrote:

Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 

 

Met vriendelijke groet - With kind regards,

Florian Groothuis
Analist/programmeur
+31 (0)6 21927914


meilink.eu

Meilink Beheer Borculo B.V. • Kamerlingh Onnesstraat 1
7271 AZ  Borculo • Nederland • +31 (0)545 253525
KvK 08009803 • Our general terms and conditions apply • Disclaimer



Florian Groothuis
 

I think I prefer: StatusBarSetText('Ingelogd als: '&User(0))

 

Van: main@magicu-l.groups.io [mailto:main@magicu-l.groups.io] Namens Frederik Soete
Verzonden: donderdag 1 juni 2017 7:07
Aan: main@magicu-l.groups.io
Onderwerp: Re: [magicu-l] User id on bottom line of Magic window.

 

Hi,

 

You can indeed add the username via some dot net snippet, e.g. like this, assuming a dot net invoke with the an expression of 'User(0)' as parameter:

using System;

using F = System.Windows.Forms;

 

public static class Snippet

{

      public static void func(System.String user)

      {

            var form = F.Form.ActiveForm;

            while (form != null && form.Parent != null) {

            form = form.Parent as F.Form;    

            }

            if (form != null) {

                  foreach (var ssc in form.Controls) {

                        if (ssc.GetType().ToString().Equals("com.magicsoftware.controls.MgStatusStrip")) {

                             var ss = (F.StatusStrip)ssc;

                             var ssi = new F.ToolStripStatusLabel(user);

                             ssi.BorderSides = F.ToolStripStatusLabelBorderSides.Left | F.ToolStripStatusLabelBorderSides.Top;

                             ss.Items.Insert(1, ssi);

                        }

                  }

            }

      }

}

 

 

 

Op 1 jun. 2017 03:07 schreef "Heidi Schuppenhauer" <heidis13@...>:

I've heard of it being done using .Net objects. Actually you can add all kinds of things to the status bar, including a nice little green "progress bar". 


Heidi.Schuppenhauer

 

 

 

 

On Wed, May 31, 2017 at 7:17 AM, Bren607 <bren607@...> wrote:

Having just converted a system from uniPaaS to XPA , I notice the user id. is missing from the bottom line of the Magic window. In uniPaaS it is normally to the left of the Modify/Query indicator. Is there an ini setting which has disabled this? 

 

Met vriendelijke groet - With kind regards,

Florian Groothuis
Analist/programmeur
+31 (0)6 21927914


meilink.eu

Meilink Beheer Borculo B.V. • Kamerlingh Onnesstraat 1
7271 AZ  Borculo • Nederland • +31 (0)545 253525
KvK 08009803 • Our general terms and conditions apply • Disclaimer



Brendan Wheeler
 

Thanks everyone for all the suggestions.
Brendan.


Wes Hein
 

What .Net assembly do you need to load to get the com.magicsoftware.controls.MgStatusStrip?

Thx

Wes 


Heidi Schuppenhauer
 

I didn't need to point to any assembly ... Frederick's excellent example just checks if the existing status bar is Magic's.

The one thing I haven't figured out though is how to ADD the new item. Mine overrides the existing label, so then the "Modify" label isn't there.

"Remove" removes an existing label, and that works.
Insert(1) overwrites the current label and pushes everything to the right.

So what does one do to add a new label to the left of the existing one?

 foreach (var ssc in form.Controls) {
                        if (ssc.GetType().ToString().Equals("com.magicsoftware.controls.MgStatusStrip")) {
                             var ss = (F.StatusStrip)ssc;
                             var ssi = new F.ToolStripStatusLabel(user);
                             ssi.BorderSides = F.ToolStripStatusLabelBorderSides.Left | F.ToolStripStatusLabelBorderSides.Top;
                             ss.Items.Insert(1, ssi);
                        }


Heidi.Schuppenhauer


 

On Mon, Jun 12, 2017 at 3:51 PM, Wes Hein <wes@...> wrote:
What .Net assembly do you need to load to get the com.magicsoftware.controls.MgStatusStrip?

Thx

Wes 



Wes Hein
 

Had to add System.Drawing to the CRR list to make it work

Wes

--

Annual Reporting Help! 
Annual Report Resources BIAS Annual Report Program (Workshops)

Wes Hein
President - Director Of Product Development
BIAS Software
509.443.3332 | Toll-Free 888.534.2427 | Fax 888.617.4437
327 E Pacific Ave, Spokane WA 99202

 
Notice: The information contained in this communication may be legally privileged, confidential or otherwise protected by law. It is intended only for the use and information of the individuals or entities to whom it is addressed. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify us and delete the original message and any copies.


Frederik Soete
 

Hi,

For what it's worth: I had proposed this example code without mentioning all caveats. I had forgotten about the status strip item that 'falls off' the status strip bar. In my case it is not the task mode indicator, but the insert/overwrite-mode indicator that drops off the status strip bar.

At the time I programmed this, I decided this ad hoc solution was good enough. In any case: when debugging, after adding the one item for the user name, there are six items where previously there were only five; the sixth item becomes invisible; but I haven't figured out how to force all six items to be visible at the same time.

Perhaps someone more advanced in Dot Net programming could prevent this 'falling off' of the sixth item?

Bye,

Frederik Soete


Heidi Schuppenhauer
 

Thanks! I sure would like to figure that one out! I played with it most of the day and no joy. But it's a real good item for the ol' .Net learning curve. That little snippet taught me a whole lot already. If I learn anything useful I'll let you know.

What came up for me is this: when the user is logged in, they have the option of logging in again as someone else, as some of the machines are shared. And when they log in AGAIN that messes up the status bar.

Now, one example I saw just erases the last control and then adds a new one. This works ... but you still lose one item.

Good challenge I say!


Heidi.Schuppenhauer


 

On Tue, Jun 13, 2017 at 6:30 AM, Frederik Soete <frederik.soete@...> wrote:
Hi,

For what it's worth: I had proposed this example code without mentioning all caveats. I had forgotten about the status strip item that 'falls off' the status strip bar. In my case it is not the task mode indicator, but the insert/overwrite-mode indicator that drops off the status strip bar.

At the time I programmed this, I decided this ad hoc solution was good enough. In any case: when debugging, after adding the one item for the user name, there are six items where previously there were only five; the sixth item becomes invisible; but I haven't figured out how to force all six items to be visible at the same time.

Perhaps someone more advanced in Dot Net programming could prevent this 'falling off' of the sixth item?

Bye,

Frederik Soete



Frederik Soete
 

Hi Heidi,

There is something in dot net for your use case, I think. It may be possible to declare a 'static' variable within the snippet, with the correct type (not just var ...), initialized with null, which can remember the toolstrip item from the last invocation. So, if it is null, you initialize it with the newly created toolstrip item, but only the first time around. On subsequent invocations, the value would not be null, and then you would only update the label of the item, i.e. the username. I'm not entirely sure this would work, but it is a feasible straregy one might try. I have not tried this at home :-)

Bye,

Frederik Soete

Op 14 jun. 2017 09:20 schreef "Heidi Schuppenhauer" <heidis13@...>:

Thanks! I sure would like to figure that one out! I played with it most of the day and no joy. But it's a real good item for the ol' .Net learning curve. That little snippet taught me a whole lot already. If I learn anything useful I'll let you know.

What came up for me is this: when the user is logged in, they have the option of logging in again as someone else, as some of the machines are shared. And when they log in AGAIN that messes up the status bar.

Now, one example I saw just erases the last control and then adds a new one. This works ... but you still lose one item.

Good challenge I say!


Heidi.Schuppenhauer


 

On Tue, Jun 13, 2017 at 6:30 AM, Frederik Soete <frederik.soete@...> wrote:
Hi,

For what it's worth: I had proposed this example code without mentioning all caveats. I had forgotten about the status strip item that 'falls off' the status strip bar. In my case it is not the task mode indicator, but the insert/overwrite-mode indicator that drops off the status strip bar.

At the time I programmed this, I decided this ad hoc solution was good enough. In any case: when debugging, after adding the one item for the user name, there are six items where previously there were only five; the sixth item becomes invisible; but I haven't figured out how to force all six items to be visible at the same time.

Perhaps someone more advanced in Dot Net programming could prevent this 'falling off' of the sixth item?

Bye,

Frederik Soete



Frederik Soete
 

Here is the code I shared earlier, but adapted to the use case of changing the user multiple times within one Magic session:

using System;
using F = System.Windows.Forms;

public static class Snippet
{
    public static void AddUserToStatusBar(System.String user)
    {
        if (ssi == null) {
           
            var form = F.Form.ActiveForm;
            while (form != null && form.Parent != null) {
                form = form.Parent as F.Form;   
            }
           
            if (form != null) {
                foreach (var ssc in form.Controls) {
                    if (ssc.GetType().ToString().Equals("com.magicsoftware.controls.MgStatusStrip")) {
                        var ss = (F.StatusStrip)ssc;
                        ssi = new F.ToolStripStatusLabel(user);
                        ssi.BorderSides = F.ToolStripStatusLabelBorderSides.Left | F.ToolStripStatusLabelBorderSides.Top;
                        ss.Items.Insert(1, ssi);
                    }
                }
            }
           
        } else {
            ssi.Text = user;
        }
    }
   
    static F.ToolStripStatusLabel ssi = null;
   
}

===

As you can see: the static variable 'ssi' is initially null, when the code has not been invoked. On the first invocation, it is set to the newly created item. On all other invocations, the label is kept intact, but it's text is changed to the new user.

I have just tested this on my end, and it seems this works. Static variables are a neat trick: you can keep references to objects intact within a snippet, while not having any reference outside the snippet at all.

Bye,

Frederik Soete.


Frederik Soete
 

Hi,

One more thing to clarify: in my case the snippet is contained within a dedicated Magic program, which may (as of now) be called multiple times. The value of the static variable is contained within that one snippet. Other snippets would have different static variables, so you should only have this snippet once in your code, and not many times over in the same project. Or else you would get several user labels at once.

Bye,

Frederik Soete.


Wes Hein
 

Frederik,

Have you gotten it to add to the status bar, not remove the far right status box?

Wes


Frederik Soete
 

Hi,

No, I do not know how to keep the last item. Microsoft's documentation is not transparent in that regard. Perhaps something is hard coded in Magic's implementation, or I am overlooking something. Sorry... Best option were that MSE restore the functionality...

Op 14 jun. 2017 20:20 schreef "Wes Hein" <wes@...>:

Frederik,

Have you gotten it to add to the status bar, not remove the far right status box?

Wes


Frederik Soete
 

Hi,

For those still reading this topic, I have found a way to keep all items visible when adding the username label to the status strip. The fix consists of setting the AutoSize property of the statusbar text (leftmost in the status strip) to true. In the code this is represented by "ss.Items[0].AutoSize = true;" This perhaps also means one could add yet other status bar items (such as the suggested progress bar) without losing any of the predefined ones. I include the complete code that adds the username to the status bar, without losing the last item (the insert/overwrite indicator).

using System;
using F = System.Windows.Forms;

public static class Snippet
{
    public static void AddUserToStatusBar(System.String user)
    {
        if (ssi == null) {
           
            var form = F.Form.ActiveForm;
            while (form != null && form.Parent != null) {
                form = form.Parent as F.Form;   
            }
           
            if (form != null) {
                foreach (var ssc in form.Controls) {
                    if (ssc.GetType().ToString().Equals("com.magicsoftware.controls.MgStatusStrip")) {
                        var ss = (F.StatusStrip)ssc;
                        ssi = new F.ToolStripStatusLabel(user);
                        ssi.BorderSides = F.ToolStripStatusLabelBorderSides.Left | F.ToolStripStatusLabelBorderSides.Top;
                        ss.Items.Insert(1, ssi);
                        ss.Items[0].AutoSize = true;
                    }
                }
            }
           
        } else {
            ssi.Text = user;
        }
    }
   
    static F.ToolStripStatusLabel ssi = null;
   
}

Bye,

Frederik Soete


Wes Hein
 

Frederik,

Thank you for this.  We are going to abandon the xpa internal security for our own so this will be very useful!

Wes