1. console display commands


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

new topic     » topic index » view message » categorize

2. Re: console display commands

katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

include std/console.e  
 
cursor(UNDERLINE_CURSOR ) 
cursor(NO_CURSOR ) 

no idea how to underline/ununderline. does ed.ex let you do it? ANSI?

new topic     » goto parent     » topic index » view message » categorize

3. Re: console display commands

This makes the console cursor not visible:

include std/console.e 
include std/get.e 
include std/dll.e 
include std/machine.e 
 
/* 

BOOL WINAPI SetConsoleCursorInfo( 
  _In_  HANDLE hConsoleOutput, 
  _In_  const CONSOLE_CURSOR_INFO *lpConsoleCursorInfo) 
   
HANDLE WINAPI GetStdHandle( 
  _In_  DWORD nStdHandle) 
   
typedef struct _CONSOLE_CURSOR_INFO { 
  DWORD dwSize; 
  BOOL  bVisible; 
} CONSOLE_CURSOR_INFO, *PCONSOLE_CURSOR_INFO 
 
*/ 
 
puts(1,"Console Cursor Not Visible\n") 
 
integer STD_OUTPUT_HANDLE = -11 
 
atom kernel32 = open_dll("kernel32.dll") 
integer SetConsoleCursorInfo = define_c_func(kernel32,"SetConsoleCursorInfo",{C_INT,C_POINTER},C_INT) 
integer GetStdHandle = define_c_func(kernel32,"GetStdHandle",{C_INT},C_INT) 
 
atom CONSOLE_CURSOR_INFO = allocate(5) 
 
integer ConsoleHandle = c_func(GetStdHandle,{STD_OUTPUT_HANDLE}) 
 
poke4(CONSOLE_CURSOR_INFO,100) 
poke(CONSOLE_CURSOR_INFO+4,0) 
 
if not c_func(SetConsoleCursorInfo,{ConsoleHandle,CONSOLE_CURSOR_INFO}) then 
	puts(1,"Couldn't set cursor info\n") 
end if 
 
if getc(0) then end if 
new topic     » goto parent     » topic index » view message » categorize

4. Re: console display commands

ne1uno said...

...

include std/console.e  
 
cursor(UNDERLINE_CURSOR ) 
cursor(NO_CURSOR ) 

I tried cursor(NO_CURSOR) first, and it didn't work for me.
I just tried it again and it works. I must've done something wrong the first time.

EDIT: I see. You have to open the console first to set the cursor.

new topic     » goto parent     » topic index » view message » categorize

5. Re: console display commands


So i have not yet tried the help that was offered, and ran into another puzzle:

[22:22] <katsmeow-afk> what i do not understand is ne1uno making me so angry i leave this channel, and then he seems to be helpful on euphorum 
[22:22] <katsmeow-afk> that is where iam stuck atm 
[22:22] <ne1uno> quit blaming me, problem solved 
[22:22] <ne1uno> next 
[22:23] <katsmeow-afk> ok, ne1uno is not responicible for anything 
[22:24] <ne1uno> two different ways to turn it off were posted. you can't take yes for an answer 
[22:24] <katsmeow-afk> <EXPLETIVE DELETED - [derek]> 
And then i left the irc channel again. All i can figure then, is after this post, not contact anyone or any communication method leading to OE, for any reason, until i have first tried 100% of the help offered on this topic in this forum. Altho why anyone else can participate in two or more threads, i don't understand.

Kat

new topic     » goto parent     » topic index » view message » categorize

6. Re: console display commands

katsmeow said...


So i have not yet tried the help that was offered, and ran into another puzzle:

[22:22] <katsmeow-afk> what i do not understand is ne1uno making me so angry i leave this channel, and then he seems to be helpful on euphorum 
[22:22] <katsmeow-afk> that is where iam stuck atm 
[22:22] <ne1uno> quit blaming me, problem solved 
[22:22] <ne1uno> next 
[22:23] <katsmeow-afk> ok, ne1uno is not responicible for anything 
[22:24] <ne1uno> two different ways to turn it off were posted. you can't take yes for an answer 
[22:24] <katsmeow-afk> <EXPLETIVE DELETED> - [derek] 
And then i left the irc channel again. All i can figure then, is after this post, not contact anyone or any communication method leading to OE, for any reason, until i have first tried 100% of the help offered on this topic in this forum. Altho why anyone else can participate in two or more threads, i don't understand.

Kat

you hijack your own thread to post edited irc logs from a private channel proving what exactly?

get some professional help, you're melting down for some reason. I think because I edited some of your code, not sure. mods no doubt take over now

new topic     » goto parent     » topic index » view message » categorize

7. Re: console display commands

ne1uno said...

you hijack your own thread to post edited irc logs from a private channel proving what exactly?

It was a straight unedited copy/paste of the "conversation" i was involved in. If others feel as you do, they may want to know you straightened me out on discussing more than one topic at a time.

ne1uno said...

get some professional help, you're melting down for some reason. I think because I edited some of your code, not sure. mods no doubt take over now

Well, as i see it, i joined the channel, asked a simple question, and instantly got jumped for not executing the help offered in this thread before i asked a question on another topic.

Kat

new topic     » goto parent     » topic index » view message » categorize

8. Re: console display commands

katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Sorry Kat, but with the more recent editions of CMD.exe from Microsoft, this is not an easy thing to do any more.

If you are writing an application for your own usage, I suggest you look into a CMD.exe replacement that supports ANSI control codes.

If you are writing an application for unknown Windows environments, you might be better to use the Windows API to simulate a 'console' output window. You can have complete control of what happens then.

For Linux environments, you can probably still get ANSI control codes to work for you, but I'm just guessing with that.

new topic     » goto parent     » topic index » view message » categorize

9. Re: console display commands

DerekParnell said...
katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Sorry Kat, but with the more recent editions of CMD.exe from Microsoft, this is not an easy thing to do any more.

If you are writing an application for your own usage, I suggest you look into a CMD.exe replacement that supports ANSI control codes.

If you are writing an application for unknown Windows environments, you might be better to use the Windows API to simulate a 'console' output window. You can have complete control of what happens then.

For Linux environments, you can probably still get ANSI control codes to work for you, but I'm just guessing with that.

That gives me an idea. I could use my oswin.e library from Redy to make a window and just put monowidth text in it, to simulate a console. It could use any monowidth font, bold, italics, and underline, with text and background colors and optional blinking cursor. It could even have clipboard, keyboard, and mouse functionality. Since it would only involve drawing graphics and text to a window, it wouldn't need the gui.e widget system, so it would be an extremely lightweight alternative to the crappy windows text console. Hmm, perhaps i will try this tomorrow.

new topic     » goto parent     » topic index » view message » categorize

10. Re: console display commands

DerekParnell said...
katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Sorry Kat, but with the more recent editions of CMD.exe from Microsoft, this is not an easy thing to do any more.

If you are writing an application for your own usage, I suggest you look into a CMD.exe replacement that supports ANSI control codes.

I am thinking a command.com loaded with ansi.sys as a device driver, the old school way. I have not tried it yet. There is an ansi.sys in winxp, but it won't load from the command line in a dos shell like it will in win95b.

DerekParnell said...

If you are writing an application for unknown Windows environments, you might be better to use the Windows API to simulate a 'console' output window. You can have complete control of what happens then.

It was for text entry and text display, attached to an irc client, plugged into the irc.e in the OE pastey. But i don't expect to be back on irc after the last few days. I asked for help making a wingui a year or more ago, that floated like cannon ball. With all the rules and regulations ne1uno told me for any code submitted to OE, while at the same time scrambling the working code to meet the rules, the devs will just scramble it some more, it will be unrecogniseable, and as a dos console will be obsolete before i use it, it's just for my own use. I pasteyed it too, it's got a bug or two, what i was thinking was if i eliminated the cursor totally, and edited the input string with the ansi codes with an underline as a faux cursor, i'd be better off. The last working code (test3) is in the comments for the code that won't launch. Tested only on this one puter in my default cmd.exe console.

Kat

new topic     » goto parent     » topic index » view message » categorize

11. Re: console display commands

Ok, using WinXP or earlier might work but I'm not sure ...

I just tried using ANSI codes on a console that supported them and it seems that Euphoria does something non-standard (still investigating) as the 'raw' text was displayed. However, writing the ANSI codes to a file then just "type"-ing the file to the console worked fine.

new topic     » goto parent     » topic index » view message » categorize

12. Re: console display commands

I done some more testing .

It seems that the problem is with the compiler's fputs() command that the Euphoria backend uses.

But ... all is not lost. You can use the put_screen_char() routine in the console.e library to emulate what you're trying to do. It does mean you need to keep track of the cursor though. put_screen_char() doesn't use the compiler fputs(), it uses native calls to the Windows API instead.

new topic     » goto parent     » topic index » view message » categorize

13. Re: console display commands

It turns out that emulating a simple console window is fairly straight forward using current Euphoria routines. I'm now working on a library to do that and I'll post the code shortly.

new topic     » goto parent     » topic index » view message » categorize

14. Re: console display commands

katsmeow said...
DerekParnell said...
katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Sorry Kat, but with the more recent editions of CMD.exe from Microsoft, this is not an easy thing to do any more.

If you are writing an application for your own usage, I suggest you look into a CMD.exe replacement that supports ANSI control codes.

I am thinking a command.com loaded with ansi.sys as a device driver, the old school way. I have not tried it yet. There is an ansi.sys in winxp, but it won't load from the command line in a dos shell like it will in win95b.

DerekParnell said...

If you are writing an application for unknown Windows environments, you might be better to use the Windows API to simulate a 'console' output window. You can have complete control of what happens then.

It was for text entry and text display, attached to an irc client, plugged into the irc.e in the OE pastey. But i don't expect to be back on irc after the last few days. I asked for help making a wingui a year or more ago, that floated like cannon ball. With all the rules and regulations ne1uno told me for any code submitted to OE, while at the same time scrambling the working code to meet the rules, [...]

Kat

not ready to be included as a module. that kind of rule. nobody asked you to meet creole or eudoc regulation or style, despite your insistence than they did.

first thing irc.e does is create a log file and connect to a channel. if editing that to behave properly is wrong, then I don't wana be right.

you need a code butler or advance IDE, not an open source collaborator. you can please stop maligning me now or I will post more details about exactly how I edited irc.e and why. history shows you're not going to like that, so I probably won't in deference to other forum members.

your other question about how to underline, you can create a custom font to do underlines. maybe use unicode.

new topic     » goto parent     » topic index » view message » categorize

15. Re: console display commands

ne1uno said...

you hijack your own thread to post edited irc logs from a private channel proving what exactly?

My understand is that it is a public channel.

ne1uno said...

not ready to be included as a module. that kind of rule. nobody asked you to meet creole or eudoc regulation or style, despite your insistence than they did.

you can please stop maligning me now or I will post more details about exactly how I edited irc.e and why. history shows you're not going to like that, so I probably won't in deference to other forum members.

It does seem that this sort of thing - a dispute between two individuals - is best discussed in private, rather than in public on the forum here.

ne1uno said...

mods no doubt take over now

Hmm - it does seem to be against the spirit of the "no venting" rule.

new topic     » goto parent     » topic index » view message » categorize

16. Re: console display commands

katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Kat, I've written the library I talked about, but now that I'm sitting back looking at it, I realize that I'm no longer sure what it is you were actually trying to achieve.

Why do you want to underline a char, and why then later remove the underline?

Why do you want to get rid of the default console cursor?

new topic     » goto parent     » topic index » view message » categorize

17. Re: console display commands

DerekParnell said...
katsmeow said...


Two short questions:

How do i underline a char in a text i puts() to the screen? And then un-underline it?
How do i get rid of the default console cursor?

Kat

Kat, I've written the library I talked about, but now that I'm sitting back looking at it, I realize that I'm no longer sure what it is you were actually trying to achieve.

Why do you want to underline a char, and why then later remove the underline?

Why do you want to get rid of the default console cursor?

I want to get rid of the stock cursor for three reasons: using position() to put it where i want it does not always put it there, reprinting the line does always put it at the end of the line, and if i can de/underline a character then i can use that instead of the stock cursor. I want to de/underline chars to use as my cursor, which i can embed in the string i puts(), which has the benefit of not needing to keep track of what the screen x,y coordinates of the cursor are vs the string linear position.

It's all mostly because i can write something that works in dos and not in windoze or nix. That said, my desire to keep using OE is dropping daily.

Kat

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu