Page 1 of 1

Winboard and 'cls'

PostPosted: 05 Mar 2010, 14:28
by xcomponent
Hello, Friends!
I'm sorry if this is a stupid question, but is there any way to clear my ICS Interaction window, something like the ics 'cls' command trough winboard?
Thanks!

Re: Winboard and 'cls'

PostPosted: 05 Mar 2010, 15:30
by matematiko
xcomponent,

This request has been asked before, for more info you can read the last post on the first page and subsequent posts in the second page of this topic:
http://www.open-aurec.com/wbforum/viewtopic.php?f=2&t=50751

Cheers,

Re: Winboard and 'cls'

PostPosted: 05 Mar 2010, 16:21
by xcomponent
Ok, thanks, it seems that i have to make a workaround.

Re: Winboard and 'cls'

PostPosted: 05 Mar 2010, 18:53
by xcomponent
Ok, here's the 'workaround' i made :)
It's a bit stupid, but works perfectly.

Code: Select all
#include <windows.h>
#include <Richedit.h>

int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpCmd,int nShow)
{
   HWND hwnd,hwndChild;
   char title[64];
   
   if((hwnd = FindWindow("WBConsole",NULL)) != INVALID_HANDLE_VALUE)
   {   //security check
      GetWindowText(hwnd, title, 64);
      if(strstr(title, "I C S Interaction:"))
      {   //the ICS interaction is the 1st child, so no worries:
         hwndChild = FindWindowEx(hwnd, NULL, "RICHEDIT", 0);
         //SetWindowText it's not going to work, it lacks the invoke of DefWindowProc()!
         SendMessage(hwndChild,WM_SETTEXT,0,(LPARAM)"");
         //Without invalidation, DefWindowProc() of the child will not update the buffer,so:
         InvalidateRect(hwndChild,0,TRUE);
      }
   }
   return 0;
}


here's a link:
[url]
http://pawny.netii.net/cls.zip
[/url]

Re: Winboard and 'cls'

PostPosted: 06 Mar 2010, 01:13
by mocha1961
xcomponent wrote:Ok, here's the 'workaround' i made :)
It's a bit stupid, but works perfectly.

Code: Select all
#include <windows.h>
#include <Richedit.h>

int WINAPI WinMain(HINSTANCE hInst,HINSTANCE hPrev,LPSTR lpCmd,int nShow)
{
   HWND hwnd,hwndChild;
   char title[64];
   
   if((hwnd = FindWindow("WBConsole",NULL)) != INVALID_HANDLE_VALUE)
   {   //security check
      GetWindowText(hwnd, title, 64);
      if(strstr(title, "I C S Interaction:"))
      {   //the ICS interaction is the 1st child, so no worries:
         hwndChild = FindWindowEx(hwnd, NULL, "RICHEDIT", 0);
         //SetWindowText it's not going to work, it lacks the invoke of DefWindowProc()!
         SendMessage(hwndChild,WM_SETTEXT,0,(LPARAM)"");
         //Without invalidation, DefWindowProc() of the child will not update the buffer,so:
         InvalidateRect(hwndChild,0,TRUE);
      }
   }
   return 0;
}


here's a link:
[url]
http://pawny.netii.net/cls.zip
[/url]



how will you input this in the winboard ini to work....just curious

Re: Winboard and 'cls'

PostPosted: 06 Mar 2010, 08:01
by xcomponent
No, just click it and the Interaction window gets cleared. That's it.

Re: Winboard and 'cls'

PostPosted: 06 Mar 2010, 15:12
by mocha1961
xcomponent wrote:No, just click it and the Interaction window gets cleared. That's it.


my ics window got cleared once but not always.

Re: Winboard and 'cls'

PostPosted: 06 Mar 2010, 23:48
by H.G.Muller
I think it should be trivial to declare the text-edit of the consoleuser-writable, rather than read-only, in the winboard.rc file. In that case you could clear it by Ctrl+A plus <Del>. And you could do much, much more, like drawing an ASCII picture of yourself.

The question could of course be: why would you want to?

Re: Winboard and 'cls'

PostPosted: 07 Mar 2010, 08:12
by xcomponent
H.G.Muller wrote:I think it should be trivial to declare the text-edit of the consoleuser-writable, rather than read-only, in the winboard.rc file. In that case you could clear it by Ctrl+A plus <Del>. And you could do much, much more, like drawing an ASCII picture of yourself.

The question could of course be: why would you want to?


But I like it read only. Besides, i don't want to recompile every time new version comes out. The thing is, that after couple of days online it gets filled badly and since clear window add is not planned, this is my personal solution and i like it - easy and separate.

Re: Winboard and 'cls'

PostPosted: 07 Mar 2010, 10:08
by H.G.Muller
Clearing is a form of writing, so you do NOT want it write-only. I stil think that making it editable is the most flexible solution, as it allows easy total clearing by two keystrokes, and would also allow selective clearing.

To solve the problem you have (accumulating output over many days) it would be much more logical to put a user-specifyable limit to the number of lines in the text field, and then automatically delete lines at the top when this size gets exceeded.