#include "mkhibliba.h" /*=============================================================================================== == Get a string form the keyboard ================================================================================================= == in fact, it stop the rowread and use ngetchx ================================================================================================= == str : string to fill == len : maximum length of the string == title : title to show in the dialog box == len1_title : width of the title in the little font (help to draw it) == text : text to draw in the dialog box, just befor the asked string ===============================================================================================*/ /* void h_getStr(hFont * font, unsigned char * str, short len, const char * title, const char * text, short lcdwidth, short lcdheight) { short j; short pos=0; short end=0; short key; str[0]='\0'; unsigned short x=(lcdwidth-6*len+10)/2; unsigned short y=(lcdheight-30)/2; short x_pos=x+6; short len_title=hStrWidth(font,title,FALSE,FALSE); h_clrFrame(x-1,x+len_title+18+2,y-1,y+9,LCD_MEM); h_clrFrame(x-1,x+6*len+11,y+8,y+31,LCD_MEM); drawhFrame(x,x+len_title+18+1,y,y+8,LCD_MEM); drawhFrame(x,x+6*len+10,y+9,y+30,LCD_MEM); Sprite16(x+1,y+1,8,h_owl,LCD_MEM,SPRT_XOR); hDrawStr(font,x+18,y+2,title,FALSE,FALSE,LCD_MEM); hDrawStr(font,x+3,y+13,text,FALSE,FALSE,LCD_MEM); x+=6; y+=21; draw: h_clrFrame(x-1,x+len*6+2,y,y+6,LCD_MEM); hDrawStr(font,x,y,str,FALSE,FALSE,LCD_MEM); hDrawStr(font,x_pos-1,y,"|",FALSE,FALSE,LCD_MEM); key: key=ngetchx(); if (key==KEY_ENTER) { return; } else if (key==KEY_ESC) { str[0]='\0'; return; } else if (key==KEY_DEL && pos>0) { //key del x_pos-=hCharWidth(font,str[--pos],FALSE,FALSE,FALSE,FALSE); for (j=pos+1;j<=end;j++) str[j-1]=str[j]; end--; } else if (key==KEY_LEFT && pos>0) { x_pos-=hCharWidth(font,str[--pos],FALSE,FALSE,FALSE,FALSE); } else if (key==KEY_RIGHT && pos256 || key==0) { // not a caracter goto key; } else if (pos=pos;j--) str[j+1]=str[j]; str[pos++]=key; x_pos+=hCharWidth(font,str[key],FALSE,FALSE,FALSE,FALSE); end++; } goto draw; }*/