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

#11 User is offline   James Ross 

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

Posted 10 February 2016 - 11:42 AM

 steamer_ctn, on 07 February 2016 - 01:00 PM, said:

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?

I believe this should be done inside "Layout"; probably right at the end. You should be able to compare the height of the Scrollbox and the TextFlow, although I'm not 100% sure.

#12 User is offline   steamer_ctn 

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

Posted 10 February 2016 - 02:25 PM

 James Ross, on 10 February 2016 - 11:42 AM, said:

I believe this should be done inside "Layout"; probably right at the end. You should be able to compare the height of the Scrollbox and the TextFlow, although I'm not 100% sure.

It appears that the code that creates the window size runs early in the process, before the text for each window is analysed. It also appears to only run once.

Once the text is analysed, the text is then fitted into the "pre-defined" window size already established.

So therefore I don't think that the text size can be used to influence the box size.

I will send a PM with some more detail.

#13 User is offline   James Ross 

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

Posted 10 February 2016 - 03:14 PM

 steamer_ctn, on 10 February 2016 - 02:25 PM, said:

It appears that the code that creates the window size runs early in the process, before the text for each window is analysed. It also appears to only run once.

Once the text is analysed, the text is then fitted into the "pre-defined" window size already established.

So therefore I don't think that the text size can be used to influence the box size.

The process is certainly outside-inwards, but there's nothing stopping the window changing its size after creation. I've just tested that and it works fine calling "SizeTo" inside "Layout". The only bit that may be tricky here is when the text is laid out. If that is after "Layout" has finished, we'll need to add an event or override some other code, but it should not overall be troublesome to do.

I'll have a look later this week.

#14 User is offline   James Ross 

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

Posted 13 February 2016 - 05:35 AM

 James Ross, on 10 February 2016 - 03:14 PM, said:

I'll have a look later this week.

I was wrong about where this needed to happen, because the text is added separately from the layout and I also had to make layout not reset the various text boxes/labels, but it's still a pretty simple change. I made the dialog 1.6x wider and taller by default and will resize up to 2x taller (than the new size) if the text needs it. I've attacged the patch if you want to try it - I think it works pretty well.

Here's how it looks in your beta tutorial activity:
https://james-ross.co.uk/temp/Open%20Rails%202016-02-13%2001-30-12.png

I do not want to go larger than this, so it's up to you if you keep the amount of text you currently have (which generally overflows by ~25%) or try and fit it in.

Attached File(s)



#15 User is offline   steamer_ctn 

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

Posted 13 February 2016 - 09:32 PM

Hi James,

 James Ross, on 13 February 2016 - 05:35 AM, said:

I was wrong about where this needed to happen, because the text is added separately from the layout and I also had to make layout not reset the various text boxes/labels, but it's still a pretty simple change. I made the dialog 1.6x wider and taller by default and will resize up to 2x taller (than the new size) if the text needs it. I've attacged the patch if you want to try it - I think it works pretty well.

Thanks for that.

I have tried to apply your patch (against #3439), but the following lines of code are bringing up errors in my development version of OR.

        	var originalMessage = Message?.Text;
        	var originalResumeLabel = ResumeLabel?.Text;
        	var originalCloseLabel = CloseLabel?.Text;
        	var originalQuitLabel = QuitLabel?.Text;
        	var originalEventNameLabel = EventNameLabel?.Text;
        	var originalStatusLabel = StatusLabel?.Text;
        	var originalStatusLabelColor = StatusLabel?.Color;


It is indicating a syntax error, ":" expected.

 James Ross, on 13 February 2016 - 05:35 AM, said:

Here's how it looks in your beta tutorial activity:

I do not want to go larger than this, so it's up to you if you keep the amount of text you currently have (which generally overflows by ~25%) or try and fit it in.

My personal preference would be to have a wider and shorter window, so that the amount of screen taken up by the window is kept to a reasonable balance (see the attached screenshot as an alternative example). Perhaps the window could be made slightly wider then the screenshot, such that the first paragraph is only on three lines.

I am not overly concerned that some text scrolling is required, as I feel that the larger window makes the text in the window is "more readable".

Given that the patch is working in your OR development version, do you wish to apply the patch?

Thanks


Attached Image: activity_window.jpg

#16 User is offline   James Ross 

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

Posted 14 February 2016 - 03:32 AM

 steamer_ctn, on 13 February 2016 - 09:32 PM, said:

        	var originalMessage = Message?.Text;
        	var originalResumeLabel = ResumeLabel?.Text;
        	var originalCloseLabel = CloseLabel?.Text;
        	var originalQuitLabel = QuitLabel?.Text;
        	var originalEventNameLabel = EventNameLabel?.Text;
        	var originalStatusLabel = StatusLabel?.Text;
        	var originalStatusLabelColor = StatusLabel?.Color;


It is indicating a syntax error, ":" expected.

I guess you're on a VS version older than 2015, that's fine I'll just change the code. It's the null-conditional operators which save some typing. I've attached the expanded version.

 steamer_ctn, on 13 February 2016 - 09:32 PM, said:

My personal preference would be to have a wider and shorter window, so that the amount of screen taken up by the window is kept to a reasonable balance (see the attached screenshot as an alternative example). Perhaps the window could be made slightly wider then the screenshot, such that the first paragraph is only on three lines.

I don't think most activity messages look that good at the width I've already widened it too, so unless we make the width dynamic too (which I'm reluctant to do) I'm not going wider. It's also a challenge that the default settings are 1024x768 windowed, as in my screenshot, so we can't get too big without using up too much space there.

Attached File(s)



#17 User is offline   steamer_ctn 

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

Posted 14 February 2016 - 12:48 PM

Hi James,

 James Ross, on 14 February 2016 - 03:32 AM, said:

I guess you're on a VS version older than 2015, that's fine I'll just change the code. It's the null-conditional operators which save some typing. I've attached the expanded version.

Thanks for that.

It now works, and I was on 2013.

 James Ross, on 14 February 2016 - 03:32 AM, said:

I don't think most activity messages look that good at the width I've already widened it too, so unless we make the width dynamic too (which I'm reluctant to do) I'm not going wider. It's also a challenge that the default settings are 1024x768 windowed, as in my screenshot, so we can't get too big without using up too much space there.

It is better then what it was, so I can live with it as now set.

Can you please approve the blueprint, and I will commit the patch.

Thanks

#18 User is offline   steamer_ctn 

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

Posted 14 February 2016 - 01:12 PM

Hi James,

An addendum.

I have just done a quick test with the changes (see attached modified Act#1 file).

It has four different message scenarios. Just click on resume after each popup window comes up.

#1 - Large message
#2 - Small message (should box revert to original or smaller size?)
#3 - Text on limit? - Note scroll bar missing
#4 - Scrollbar back again (by adding extra line to #3)

Any thoughts?

Thanks

Attached File(s)



#19 User is offline   James Ross 

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

Posted 15 February 2016 - 12:56 PM

 steamer_ctn, on 14 February 2016 - 01:12 PM, said:

It has four different message scenarios. Just click on resume after each popup window comes up.

#1 - Large message
#2 - Small message (should box revert to original or smaller size?)
#3 - Text on limit? - Note scroll bar missing
#4 - Scrollbar back again (by adding extra line to #3)

Any thoughts?

#1 and #2 work correctly; the dialog is now wider and reverts to the smaller height on #2.

#3 is a latent bug, probably because the scaling doesn't use a whole number of lines. Fixed by increasing the size by whole lines - you now have exactly 10 lines for small and exactly 20 lines for large.

#20 User is offline   steamer_ctn 

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

Posted 15 February 2016 - 01:05 PM

 James Ross, on 15 February 2016 - 12:56 PM, said:

#1 and #2 work correctly; the dialog is now wider and reverts to the smaller height on #2.

#3 is a latent bug, probably because the scaling doesn't use a whole number of lines. Fixed by increasing the size by whole lines - you now have exactly 10 lines for small and exactly 20 lines for large.

Thanks for that.

Will you commit the patch?

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