Update (recreate?) Edit widget without changing scroll pos


22-08-2009 12:31:56

I want to highlight on mouse over my talking dialogue response options. This is the code that (almost) works, but there is a problem if the text is larger than the edit widget. The recreated text gets scrolled.

I'd like to save the current scroll position before i clean the edit widget, and restore it after recreating.

void DialogueGui::PrintResponsesForDialogue( Dialogue* dialogue, int x, int y , bool refresh /*= false*/ )
size_t scroll;
scroll = mResponsesGui->getScrollPage(); //this does not work due to the fact it's private
scroll = 0;

int i=0;
MyGUI::IntPoint point;
point.top = y - mResponsesGui->getAbsoluteTop();

for(std::vector<Ogre::String>::iterator it = dialogue->getResponses().begin(); it!= dialogue->getResponses().end(); it++)
DialogueResponse *response = DialogueManager::getSingleton()->getResponse(*it);
responseRegion rr;
rr.coord = mResponsesGui->getTextSize().height - mResponsesGui->getFontHeight();
rr.response = response;

Ogre::UTFString color;
if(point.top > rr.coord && point.top < rr.coord + mResponsesGui->getFontHeight())
color = L"#CC4433";
else color = L"#FFFFFF";
const Ogre::UTFString& currentDisplay = StringManager::getSingleton()->get(response->getTextID());

mResponsesGui->addText(color + currentDisplay);

std::wcout << rr.coord << currentDisplay.asUTF8_c_str() << std::endl;
mResponsesGui->notifyScrollChangePosition(0,scroll); //this does not work due to the fact it's private
Sorry for the a bit messy code.


23-08-2009 05:28:05

show printscreen


23-08-2009 07:21:40

What for ? I'd need to show a movie. As I add text which size exceeds the size of the edit widget the text gets scrolled down to show the last line. As I recreate the text in a eventMouseMove it is not possible to click the first line. Even if i'd lock scrolling on adding text it wouldn't be the desired effect, because then I would not be able to click the last text line. I need to save the current scroll position before recreating the text, and restore the scroll position afterwards.


23-08-2009 13:24:32

The list with multilower case lines is necessary to you?


23-08-2009 19:50:31

Something like this, yes, but I handle it myself using a simple Edit widget. All I really need is to get the current Edit widget scroll position, and scroll the text from code.


24-08-2009 21:32:16

Leave it for now. Functionality that you need will be implemented soon.