Ok so this time i made a program that creates a subwin called son and it defines it's size and location. The application paints son's background with the color RED but it doesn't update all of it. When i set stdscr's background color and wrefresh it it updates all of its background. When i do the same with son it only paints where i wrote some text, why?
I found out if i add a wclear(son) after setting it's background color and then add text and finally refresh it, it updates all of it's background color.
Is this problem hapenning because refresh only updates parts of the window that actually changed it character? Then how come when i did that to stdscr it worked?
Thanks a lot!
Also if u uncomment the line of code below it will work as i wanted.
son = subwin(stdscr,5,20,10,15);
//wclear(son); //Remove this to make it work... but why isn't a refresh enough?
Thanks once more and sorry guys i think i'll be asking a lot D:
Hmm, seems like a bug. I'll look into it further.
OK, here's the deal:
wbkgd() only changes the cells that already have the background attribute. In your program, you first create the "son" subwindow, and only then do you change the background of the parent window (stdscr). This leaves the subwindow with the background attribute it had when it was created - which no longer matches the actual cells (since these are the same as stdscr's), which were changed by the first wbkgd() call. Thus, none of the cells in "son" are recognized as having the background attribute, and none are changed.
If you move the creation of "son" to after the first wbkgd() call (the one on stdscr), it will work as you intend.
ncurses works differently here, for some reason. But on review, I don't think that this is a PDCurses bug after all.
oh i understand mate
thanks for another great reply!
Btw i have another question(yes another one lmao):
Ok so i am using PDCurses' structure to work with mouse and to detect a left mouse click i'm using BUTTON_STATUS(1);
But the thing is: if i hold it down it detects as a press. Is there a function that returns true if the left button of the mouse is released?
thank you once again ahahha ;)
Yes, you can get press and release events for all buttons. If you need an example, check out the "Input Test" section of the "testcurs" demo program.
hmm thank you good sir but now i found another problem:
for it to identify it as a released event it is required for you to hold down the left mouse button a little bit then releasing it…
If you quickly press the mouse button it would recognize as a "click" not as a "press"(thus not allowing me to get the "release" event)…
is there a way to change the delay value so it always recognizes as a "press" instead of a "click" event?
Oh wait i just did
and it worked as i wanted.
Thank you wmcbrine you are really good at this ;)