Chris asked 2016-10-04 00:27:28 UTC
So in the Visual WebGui version of my IRC chat, I had incoming messages appear in an HTML Box so they'd have links, smileys, etc. I discovered that the HTML Box would blink as it refreshed whenever the HTML property was set, and I needed it to stay scrolled to the bottom anyway, so I added some Javascript functions to the initial HTML that would add an incoming message to a div and then scroll the div to the bottom instead of setting the HTML property every time.
The two functions in the HTML header are:
function myHtmlScroll(objWindow) {
var objBody = objWindow.document.body;
if (objBody.scrollHeight > objBody.clientHeight) {
objBody.scrollTop = objBody.scrollHeight - objBody.clientHeight;
}
}
function AddMsg(NewText) {
var objBody = document.getElementById('chatdiv');
objBody.innerHTML +=NewText;
myHtmlScroll(window);
}
And whenever a message came in I'd call that with:
VWGClientContext.Current.Invoke("GenericIframeInvoke", ASChatMain.ID.ToString(), strMethod, strParm)
function GenericIframeInvoke(strId, strFunctionName, parm1, parm2, parm3, parm4, parm5) {
var objFrame = document.getElementById("TRG_" + strId);
if (objFrame) {
var objMethod = objFrame.contentWindow[strFunctionName];
if (typeof objMethod === "function")
objMethod.call(null, parm1, parm2, parm3, parm5, parm5);
}
}
How do I go about doing that with the HTML Panel in WiseJ? Or is there a better way to accomplish the rich text + no blink + scroll to bottom thing? I thought I might be able to get away with a label with AllowHTML set on, but it has no scrollbar options and the old autosize-inside-a-panel trick didn't seem to work.
Thanks,
Chris
Chris asked 2016-10-04 00:27:28 UTC
So in the Visual WebGui version of my IRC chat, I had incoming messages appear in an HTML Box so they'd have links, smileys, etc. I discovered that the HTML Box would blink as it refreshed whenever the HTML property was set, and I needed it to stay scrolled to the bottom anyway, so I added some Javascript functions to the initial HTML that would add an incoming message to a div and then scroll the div to the bottom instead of setting the HTML property every time.
The two functions in the HTML header are:
function myHtmlScroll(objWindow) {
var objBody = objWindow.document.body;
if (objBody.scrollHeight > objBody.clientHeight) {
objBody.scrollTop = objBody.scrollHeight - objBody.clientHeight;
}
}
function AddMsg(NewText) {
var objBody = document.getElementById('chatdiv');
objBody.innerHTML +=NewText;
myHtmlScroll(window);
}
And whenever a message came in I'd call that with:
VWGClientContext.Current.Invoke("GenericIframeInvoke", ASChatMain.ID.ToString(), strMethod, strParm)
function GenericIframeInvoke(strId, strFunctionName, parm1, parm2, parm3, parm4, parm5) {
var objFrame = document.getElementById("TRG_" + strId);
if (objFrame) {
var objMethod = objFrame.contentWindow[strFunctionName];
if (typeof objMethod === "function")
objMethod.call(null, parm1, parm2, parm3, parm5, parm5);
}
}
How do I go about doing that with the HTML Panel in WiseJ? Or is there a better way to accomplish the rich text + no blink + scroll to bottom thing? I thought I might be able to get away with a label with AllowHTML set on, but it has no scrollbar options and the old autosize-inside-a-panel trick didn't seem to work.
Thanks,
Chris