Elvas Tower: Activity Events Window - Elvas Tower

Jump to content

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

Activity Events Window Rate Topic: -----

#1 User is offline   dforrest 

  • Foreman Of Engines
  • Group: Status: Contributing Member
  • Posts: 977
  • Joined: 12-January 12
  • Gender:Male
  • Location:St. Vincent (formally UK)
  • Simulator:MSTS, Open Rails
  • Country:

Posted 30 January 2016 - 10:24 AM

Can the Activity Events window be made larger or, even better, be made adjustable in size?

#2 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 1,889
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 03 February 2016 - 02:28 AM

The ability to make the activity pop-up window bigger in some instances, such as were there is a relatively large amount of text, has also been suggested through the uktrainsim site.

Is this a possibility, perhaps as a switchable option, and easy to implement?

Thanks

#3 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 03 February 2016 - 03:06 AM

View Poststeamer_ctn, on 03 February 2016 - 02:28 AM, said:

The ability to make the activity pop-up window bigger in some instances, such as were there is a relatively large amount of text, has also been suggested through the uktrainsim site.

Is this a possibility, perhaps as a switchable option, and easy to implement?

It's probably possible to make it resize itself to fit the text, as long as there is a limit, but don't bother with an options - just do it. :)

(When the UI is redone in https://blueprints.l...pec/gui-refresh it will definitely be fixed.)

#4 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 1,889
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 03 February 2016 - 12:41 PM

Hi James,

Thanks for the reply.

When is the UI programmed to be done? As at the moment, I don't know how to set up the window resizing, and I would need to try and work out the code?

Thanks

#5 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 04 February 2016 - 11:29 AM

View Poststeamer_ctn, on 03 February 2016 - 12:41 PM, said:

When is the UI programmed to be done? As at the moment, I don't know how to set up the window resizing, and I would need to try and work out the code?

The new UI work is stalled at the moment, so I wouldn't worry about it.

As for the resizing, you just need to call "SizeTo(int width, int height)" once you've figured out the right size. I suggest that you do this at the end of the "ActivityWindow.Layout" function, but taking care not to get in to a loop - calling "SizeTo" will trigger "Layout" again, but only if the new size is different. The calculation will involve the "scrollbox" and "Message" variables in some way, maybe just as simply as figuring out which is taller and by how much. You can get the current size from "Location".

#6 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 1,889
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 04 February 2016 - 08:36 PM

Hi James,

Thanks for the feedback.

View PostJames Ross, on 04 February 2016 - 11:29 AM, said:

The new UI work is stalled at the moment, so I wouldn't worry about it.

Ok, I will not hold my breath waiting on it.

I have now had time to play with the code in the ActivityWindow.cs file, and found the following.

View PostJames Ross, on 04 February 2016 - 11:29 AM, said:

As for the resizing, you just need to call "SizeTo(int width, int height)" once you've figured out the right size. I suggest that you do this at the end of the "ActivityWindow.Layout" function, but taking care not to get in to a loop - calling "SizeTo" will trigger "Layout" again, but only if the new size is different.

Firstly, I had a play with the SizeTo statement with fixed values, and you are correct that it does resize the window.

For comparison, I have attached some screenshots. The original window is attached as "orig.jpg". I think that its size is "fixed" at 383 x 158 (according to the "Location" information).

I set the SizeTo statement to 766 x 316, and got the box shown in "sizeto.jpg". Which didn't appear to preserve the same proportions as the original by leaving a big gap at the bottom of the window.

Upon investigation, it appears that the pop up window is made up of a number of boxes, including the outer darker box, and the text box.

I then added scaling factors to code lines 42 & 51 as below.

: base(owner, Window.DecorationSize.X + owner.TextFontDefault.Height * 2 * 25, Window.DecorationSize.Y + owner.TextFontDefault.Height * 2* 8 + ControlLayout.SeparatorSize * 2, Viewer.Catalog.GetString("Activity Events"))


var hbox = vbox.AddLayoutHorizontal(Owner.TextFontDefault.Height * 2 * 6);


The result is shown in "scaled.jpg". This appears to be a more pleasing effect for boxes with larger volumes of text.

As each activity window will have different amounts of text in them, trying to scale the box off the text amount (I am still not certain how to do this) will probably result in various size pop boxes appearing throughout the activity, which may not be a pleasant effect, depending upon the parts of the screen that they cover.

My personal preference would be:
i) to use a scaling factor
ii) set it in the activity (act) file so that an activity builder can control how big or small the boxes are displayed.

As I am still uncertain about how to size the boxes off the text, if you feel that it can and should be done on that basis, can you provide some additional clues about how to do it?

Thanks

Attached thumbnail(s)

  • Attached Image: orig.jpg
  • Attached Image: sizeto.jpg
  • Attached Image: scaled.jpg


#7 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 05 February 2016 - 10:12 AM

View Poststeamer_ctn, on 04 February 2016 - 08:36 PM, said:

I set the SizeTo statement to 766 x 316, and got the box shown in "sizeto.jpg". Which didn't appear to preserve the same proportions as the original by leaving a big gap at the bottom of the window.

Looks like the code lays it out at a fixed height instead of flexing it. This should be reasonably easy to fix by changing the following code:

                var hbox = vbox.AddLayoutHorizontal(Owner.TextFontDefault.Height * 6);

To something like:

                var hbox = vbox.AddLayoutHorizontal(vbox.RemainingHeight - (ControlLayout.SeparatorSize + vbox.TextHeight) * 2);

I also recommend that the resizing only happens in the vertical dimension, otherwise it will indeed look very odd throughout an activity.

Do NOT let this be set in the activity file; any kind of information like this is very sensitive to changes in the interface (both visual and structural) and would likely become obsolete or need replacement with another, different value.

#8 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 1,889
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 05 February 2016 - 10:56 PM

Hi James,

Thanks for the feedback.

View PostJames Ross, on 05 February 2016 - 10:12 AM, said:

                var hbox = vbox.AddLayoutHorizontal(vbox.RemainingHeight - (ControlLayout.SeparatorSize + vbox.TextHeight) * 2);



I am sorry, but I still need some clarification.

Is it simply a case of replacing the appropriate line with the above code, or are there some other calculations that need to also be done?

I have inserted the above line, and the box appears to be the same size as the default one.

Thanks

#9 User is online   James Ross 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 5,490
  • Joined: 30-June 10
  • Gender:Not Telling
  • Simulator:Open Rails
  • Country:

Posted 06 February 2016 - 01:36 PM

View Poststeamer_ctn, on 05 February 2016 - 10:56 PM, said:

Is it simply a case of replacing the appropriate line with the above code, or are there some other calculations that need to also be done?

I have inserted the above line, and the box appears to be the same size as the default one.

Yes, replace the existing line with mine. My line wasn't tested so might need some tweaking, that's all.

If the window is kept the same size as it is now, my change won't make any difference - however, if you make the window bigger with a "SizeTo" then it should make things lay out much better than they currently do.

#10 User is offline   steamer_ctn 

  • Open Rails Developer
  • Group: Status: Elite Member
  • Posts: 1,889
  • Joined: 24-June 11
  • Gender:Male
  • Country:

Posted 07 February 2016 - 01:00 PM

Hi James,

View PostJames Ross, on 06 February 2016 - 01:36 PM, said:

Yes, replace the existing line with mine. My line wasn't tested so might need some tweaking, that's all.

If the window is kept the same size as it is now, my change won't make any difference - however, if you make the window bigger with a "SizeTo" then it should make things lay out much better than they currently do.

Thanks for the further feedback.

The window now appears to resize correctly.

The final piece of the puzzle is how to trigger a resize of the popup window?

Can you see where the amount of text to be displayed in the window can be measured, and then compared to trigger the SizeTo statement if it is over a certain amount?

Thanks

  • 3 Pages +
  • 1
  • 2
  • 3
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users