Author Topic: [solved] Graphic problems while using console and messageboxes  (Read 3054 times)

0 Members and 1 Guest are viewing this topic.

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Lets say i have this function:


Code: [Select]


int main()
{

   nio_console csl;
   lcd_ingray();
   clrscr();
   nio_InitConsole(csl, 54, 30, 0, 0, 0, 15);
   nio_DrawConsole(csl);
   nio_drawing_enabled(&csl,TRUE);
   nio_cursor_type(&csl, NIO_CURSOR_UNDERSCORE);
   doSomething();
}


int doSomething()
{

   const char * title = "Title";
   const char * subtitle = "Sub titile";
   const char * msg1 = "Element 1";
   const char * msg2 = "Element 2";
   char * defaultvalue = "default value";
   char * value;
   int len;


   
   int value1 = 42;
   int value2 = 1337;
   char popup1_result[256];
   char popup2_result[256];
   if (show_1numeric_input(title, subtitle, msg1, &value1, -42, 9001) != 1) return 0;
   sprintf(popup1_result, "%s:%d", msg1, value1);
   show_msgbox(title, popup1_result);
}
(It's some code of the "ndless_popup_tests" example)


Than that results in a completely awkward screen.
If i use standard messagebox with title and content then it works perfectly and the box will be drawn over the console window.
However, using the used messagebox works so its just a graphical problem.
Is there a possibility to close the console window somehow and open it afterwards?
« Last Edit: July 20, 2014, 11:35:08 am by Virusscript24 »

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: [ndless] Graphic problems while using console and messageboxes
« Reply #1 on: July 20, 2014, 10:12:38 am »
seems to be a problem with the grayscale mode...


if i add lcd_incolor();when i call the function, it "just" makes this graphical bug


EDIT: when i use the f10 (connect) command of the emulator, the screen is refreshed and it displays correctly.
Is there any similiar method in c or any ndless related library?
« Last Edit: July 20, 2014, 10:16:12 am by Virusscript24 »

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: [ndless] Graphic problems while using console and messageboxes
« Reply #2 on: July 20, 2014, 10:23:47 am »
Problem solved now:


if you want to display messageboxes and console together, you have to switch between grayscale mode and color mode with


lcd_incolor();
lcd_ingray();
else it produces such graphic bugs  :w00t:
« Last Edit: July 22, 2014, 06:18:01 pm by Virusscript24 »

Offline Legimet

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 336
  • Rating: +29/-0
    • View Profile
Re: [solved] Graphic problems while using console and messageboxes
« Reply #3 on: July 22, 2014, 01:33:05 pm »
Using refresh_osscris a bad idea. I would advise you never to use it, because it refreshes the documents screen, which can take forever if you have a lot of folders. A better way would be to create your own dialog box functions. Or better yet, just ask for the number in the console itself.

Offline CiriousJoker

  • LV2 Member (Next: 40)
  • **
  • Posts: 34
  • Rating: +1/-0
    • View Profile
Re: [solved] Graphic problems while using console and messageboxes
« Reply #4 on: July 22, 2014, 04:53:41 pm »
For now, it works fine and if the user has so much folders, its not my fault  :P
Right now i dont notice any delay and i have quite some folders...
I don't think this much of a problem. I just used this version with the messagebox
because i was too lazy to make my own console function, this way its one line + some stuff
around to get the data into a struct.


However, thanks for the notice, if i feel some delay, i'll make use of it  :thumbsup:


EDIT: tryed it out on my real calculator and it really slowed it down, thanks, i fixed it <3
« Last Edit: July 22, 2014, 06:17:38 pm by Virusscript24 »