xOS v0.07 -- testing needed!

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
monobogdan
Member
Member
Posts: 71
Joined: Wed Jan 25, 2017 3:37 pm

Re: xOS v0.07 -- testing needed!

Post by monobogdan »

omarrx024 wrote:
monobogdan wrote:Looks nice :)

Is checkbox/combobox/multiline textbox controls implemented, or it's only showcase?
Thanks!
No, the only components implemented at the moment are label, button and gbutton (which is basically a button whose look can be enhanced). The text box is my next coming priority, and then the list box, as both are needed for the file manager I have in mind, and the text box is the main thing in a text editor as well. :)
Implementing textbox is easy.

You simply need add chars to textbuffer.

Some example code:

Code: Select all


int x;
int y;
string str;

void process(int keychar) {
  if(keychar != vk_return & keychar != vk_escape & keychar != vk_control & keychar != vk_space) {
    str += (char)keychar;
  }
  if(keychar == vk_backspace) {
    str = str.remove(str.length, 1);
  }
}

void draw() {
  drawstr(x, y, str);
}

User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: xOS v0.07 -- testing needed!

Post by BrightLight »

monobogdan wrote:Implementing textbox is easy.

You simply need add chars to textbuffer.
You also need to handle line overflows/text wrapping, select all, some copy/paste mechanism, arrow keys and cursor position, etc...
You know your OS is advanced when you stop using the Intel programming guide as a reference.
monobogdan
Member
Member
Posts: 71
Joined: Wed Jan 25, 2017 3:37 pm

Re: xOS v0.07 -- testing needed!

Post by monobogdan »

omarrx024 wrote:
monobogdan wrote:Implementing textbox is easy.

You simply need add chars to textbuffer.
You also need to handle line overflows/text wrapping, select all, some copy/paste mechanism, arrow keys and cursor position, etc...

Code: Select all


int MAX_STR = 255;
int x;
int y;
string str;

void process(int keychar) {
  if(keychar != vk_return & keychar != vk_escape & keychar != vk_control & keychar != vk_space & str.length() < MAX_STR) {
    str += (char)keychar;
  }
  if(keychar == vk_backspace) {
    if(str.length() > 0) {
      str = str.remove(str.length, 1);
    }
  }

}

void draw() {
  drawstr(x, y, str);
}
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: xOS v0.07 -- testing needed!

Post by dozniak »

monobogdan wrote:

Code: Select all


void process(int keychar) {
  if(keychar != vk_return & keychar != vk_escape & keychar != vk_control & keychar != vk_space & str.length() < MAX_STR) {
    str += (char)keychar;
  }
  if(keychar == vk_backspace) {
    if(str.length() > 0) {
      str = str.remove(str.length, 1);
    }
  }

}

void draw() {
  drawstr(x, y, str);
}
omarrx024 wrote:You also need to handle ...text wrapping,
No handling in this code.
omarrx024 wrote: select all,
No handling in this code.
omarrx024 wrote: some copy/paste mechanism
No handling in this code.
omarrx024 wrote:, arrow keys and cursor position,
No handling in this code.
omarrx024 wrote: etc...
Error in your code: when you press backspace it will be added to the string first, and then removed from the string, so the string itself will remain unchanged. Error #2: you cannot enter spaces into the string.
Learn to read.
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: xOS v0.07 -- testing needed!

Post by BrightLight »

dozniak wrote:No handling in this code.
Anyways, my OS is written in assembly, and I'm going to implement the text box in assembly, so either way I cannot use this code.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
monobogdan
Member
Member
Posts: 71
Joined: Wed Jan 25, 2017 3:37 pm

Re: xOS v0.07 -- testing needed!

Post by monobogdan »

Error in your code: when you press backspace it will be added to the string first, and then removed from the string, so the string itself will remain unchanged. Error #2: you cannot enter spaces into the string.
You can enter spaces.

It's sample code for example.

OP, why you not write applications in C, Pascal or anything?
User avatar
BrightLight
Member
Member
Posts: 901
Joined: Sat Dec 27, 2014 9:11 am
Location: Maadi, Cairo, Egypt
Contact:

Re: xOS v0.07 -- testing needed!

Post by BrightLight »

monobogdan wrote:OP, why you not write applications in C, Pascal or anything?
I will write a C library for my OS to let users have a "standard" way of writing applications, but in my early stages such as I am in now, it's unlikely anyone would write anything for me. In fact, it's unlikely anyone would write anything for anyone else on this forum, and so it's not high in my to-do list.
You know your OS is advanced when you stop using the Intel programming guide as a reference.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: xOS v0.07 -- testing needed!

Post by dozniak »

monobogdan wrote:
Error in your code: when you press backspace it will be added to the string first, and then removed from the string, so the string itself will remain unchanged. Error #2: you cannot enter spaces into the string.
You can enter spaces.
I'm pretty sure you can not with the code you posted.

Code: Select all

& keychar != vk_space
Learn to read.
User avatar
MichaelFarthing
Member
Member
Posts: 167
Joined: Thu Mar 10, 2016 7:35 am
Location: Lancaster, England, Disunited Kingdom

Re: xOS v0.07 -- testing needed!

Post by MichaelFarthing »

monobogdan,

Though far too polite to tell you so directly, Omarxx is miles ahead of you in his understanding of what is needed.
There is an English saying, "Trying to teach your grandmother to suck eggs" which roughly means that you are a relative beginner trying to give unnecessary lessons to an experienced person.
Post Reply