Hi there Amigans.
Last year I finally could learn C/C++, and being a MUI fan dived right into MUI coding.
Then I thought to start coding something I’ve always needed would be a good way to learn MUI faster… and would be fun too.
So I’ve started my project…
In this humble project of mine, I needed a TextEditor gadget (later it turned out that I actually needed 2 of them – one for edit and one for display).
I like the TextEditor.mcc functionalities… so decided to use it (no problems yet).
As I progressed, I realized that the TextEditor_WrapMode_NoWrap, is not fully implemented yet (no horizontal scrolling).
Ok, no worries. I could wait for the developers to implement it (the reasonable idea).
Or I could hack its source code and implement it myself (not a good idea).
Or… maybe I can write a dirty workaround for it using a ScrollGroup…
If I could put the text editor inside a ScrollGroup (actually into its VirtualGroup), and resize the TextEditor gadget everytime the text inside exceeds the gadget width, the effect would be just the thing needed.
And if the developers would implement the functionality in the future, I would just get rid of the ScrollGroup and use the built in scroller.
Then I wrote a quick centralized prototype to see if the idea works. It did. This is the result:
It worked like a charm.
So I decided to encapsulate all my dirty functions and variables into a subclassed version (which is the recommended way of MUI coding).
So I did it. But something very awkward has occurred. This is the result:
This is the code I resize the TextEditor and make the scroller visible:
if (result > width)
{ DoMethod(data->obj_table.virt_group, MUIM_Group_InitChange);
set(data->obj_table.text_editor, MUIA_FixWidth, result);
DoMethod(data->obj_table.virt_group, MUIM_Group_ExitChange);
set(data->obj_table.horiz_scroller, MUIA_ShowMe, TRUE);
was_bigger = TRUE;
make_cursor_visible(cl, obj);
}
else if(was_bigger)
{ DoMethod(data->obj_table.virt_group, MUIM_Group_InitChange);
set(data->obj_table.text_editor, MUIA_FixWidth, width);
DoMethod(data->obj_table.virt_group, MUIM_Group_ExitChange);
set(data->obj_table.horiz_scroller, MUIA_ShowMe, FALSE);
was_bigger = FALSE;
}
Setting MUIA_ShowMe when in a centralized function call works...
But when it is in a subclass, it messes up like this.
Any ideas?