Aller au contenu

Photo

(Advanced) XML - snaptobottom > snaptotop? (RESOLVED!)


  • Veuillez vous connecter pour répondre
8 réponses à ce sujet

#1
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi,

I have a text window that updates with text depending upon the button clicked.

However, some text is long and the player may scroll down to the end of the text within that window.

The problem: When the player clicks on another item, the text window does not "update" the text window properly. i.e. The text changes, but you cannot see it because the text window has been left in its scroll down state from the previous text.

You can click in the window and scroll it back into view, but this may be misleading to players.

Is there a way to force the text to show from the top again? (A bit like the opposite of snaptobottom.)

Thanks in advance,
Lance.

Modifié par Lance Botelle, 16 septembre 2013 - 02:10 .


#2
kevL

kevL
  • Members
  • 4 075 messages
hey Lance,

you mean a Gui window with text? I wonder if you might try a bit of a kludge by refreshing the gui-box quickly with NULL or a short string of nonsense text. Then immediately, or quickly, afterward refresh the gui-box again with the real text

#3
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

hey Lance,

you mean a Gui window with text? I wonder if you might try a bit of a kludge by refreshing the gui-box quickly with NULL or a short string of nonsense text. Then immediately, or quickly, afterward refresh the gui-box again with the real text



Hi KevL,

Yes, that is what I mean. Thanks for responding.

I also tried the "refresh" idea, but it did not work. However, I was doing other tests at the time (as well) and so I will give that another go. However, it just occurred to me to try refreshing the window as I exit the current text as opposed to before I enter it again. I'll let you know how I get on.

If you (or anybody else) has any more ideas (or knows how to get around this problem), then please let me know.

Many Thanks, Lance.

#4
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages
Hi KevL (and all),

No, I still cannot get the cursor to return to the top of the page if it has been scrolled down previously.

Any more ideas?

Cheers,
Lance.

#5
kevL

kevL
  • Members
  • 4 075 messages
hey Lance,

what 'bout if you close the window entirely and start a new instance, with the same buttons etc?


/gah
Ps. Obsidian Programmer might note the proper usage somewhere ... btw, it's possible although 'stretching', that by setting a parameter like "draggable" ( or something ) the text will refresh correctly. (seems unlikely tho)

Pps. I'm guessing that only barebones HTML tags are supported in Gui-boxes -- but it might be worth keeping in mind...



[edit] on the page linked above, try

autolayout
This attribute is only of interest in message-box style GUI screens. If enabled, the engine will attempt to automatically position the text, the 'okay', and the 'cancel' button in a classic message box layout. If left false, then the engine will not attempt to arrange any of the contents of the messagebox when the message box is requested. It is false by default


It just might work, esp. if you spec. an updaterate also

Modifié par kevL, 04 septembre 2013 - 05:56 .


#6
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

hey Lance,

what 'bout if you close the window entirely and start a new instance, with the same buttons etc?


/gah
Ps. Obsidian Programmer might note the proper usage somewhere ... btw, it's possible although 'stretching', that by setting a parameter like "draggable" ( or something ) the text will refresh correctly. (seems unlikely tho)

Pps. I'm guessing that only barebones HTML tags are supported in Gui-boxes -- but it might be worth keeping in mind...



[edit] on the page linked above, try

autolayout
This attribute is only of interest in message-box style GUI screens. If enabled, the engine will attempt to automatically position the text, the 'okay', and the 'cancel' button in a classic message box layout. If left false, then the engine will not attempt to arrange any of the contents of the messagebox when the message box is requested. It is false by default


It just might work, esp. if you spec. an updaterate also


Hi KevL,

I'll give some of those suggestions a try. I did read about that autolayout, but thought it was more to do with buttons that text, but its still worth a shot as I am having no joy in any other way.

Cheers,
Lance

#7
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

hey Lance,

what 'bout if you close the window entirely and start a new instance, with the same buttons etc?

<SNIP>


Hi KevL,

I finally found a workaround ... fix. It was not too dissimilar to some of the options we discussed at the start, but the final fix was a little obscure to say the least: As it turned out, the solution was to send a brief "other" description prior to refreshing the text object with the description I wanted. However, while one would have thought a simple null text  (e.g. " ") would have sufficed, it did not.

Here is how I worked out how to fix the problem, as it varies according to your text box ...

Basically, as I was testing this, I noticed that some item descriptions would "reset" the text box so that the text that followed would be set back up at the top of the box, which is what I wanted. However, not every description did this. i.e. An item description too long (that needed the scroll bar) or too short always made the next description that appeared to be "off" (already partly scrolled or even out of sight of the scroll had gone some way down before). However, (and here was the trick), some item description texts that filled the text screen just right caused the text window to reset for the next clicked item! It was a "goldilocks" solution. i.e. If the text prior to the next to be displayed was "just right", then it would reset the text box so that the text that followed was formatted correctly!

So, after some testing, I discovered that subject to the size of the text box, you have to send a load of \\n in the form of a text string to "fill" the box to its sweet spot. For my inventory window I had to send 22 \\n and the store 21 \\n.

e.g.

SetGUIObjectText(OBJECT_SELF, "SCREEN_STORE", "BoxText", -1, " \\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n "); //21
   DelayCommand(0.1, SetGUIObjectText(OBJECT_SELF, "SCREEN_STORE", "BoxText", -1, sDescription));

And so there you have it! It requires a little testing depending on your text box, but once you find it, that's the solution.

Cheers,
Lance.

Modifié par Lance Botelle, 16 septembre 2013 - 02:12 .


#8
kevL

kevL
  • Members
  • 4 075 messages
what're the odds?

<g>

#9
Lance Botelle

Lance Botelle
  • Members
  • 1 480 messages

kevL wrote...

what're the odds?

<g>


Posted Image

Lance.