Post Reply 
Input field removal?
04-05-2022, 11:00 PM
Post: #1
Input field removal?
I am going to try to create an input method for my own simple calculator, what I would like to know is, is there a way to remove the Vertical line from the left hand side of the second last line from bottom of screen that this creates?

[Image: input%20REMNANT.jpg?raw=1]

It is the only trace that an INPUT has been called, and I don't want to use it, because I want the field of entry to update as I type it in.


EXPORT BTest()
BEGIN
LOCAL D:="";
RECT_P();
INPUT({{D,[2],{0,0,6}}},"Number Entry","","");
TEXTOUT_P(D,23,45);
WAIT(1);
END;
Find all posts by this user
Quote this message in a reply
04-07-2022, 01:39 AM (This post was last modified: 04-07-2022 01:46 AM by Gene222.)
Post: #2
RE: Input field removal?
You should not use the INPUT command to create a graphic background screen. The INPUT command stops or pauses program execution, so you can't write text over the INPUT screen using TEXTOUT_P. The text you are writing in the screens shot is just the edit line for the INPUT textbox for variable D.

If you want to create your own INPUT screen, take a look at the AASHTO-93 1.0 app located on hpcalc.org under HP Prime Science Apps.
Find all posts by this user
Quote this message in a reply
04-07-2022, 02:53 AM
Post: #3
RE: Input field removal?
It appears it is not possible to hide the field completely, like you're trying to do. It is not overly difficult to make your completely custom Input programs, which would give you total control. I can share an example if you're interested.
Visit this user's website Find all posts by this user
Quote this message in a reply
04-07-2022, 09:06 PM
Post: #4
RE: Input field removal?
(04-07-2022 01:39 AM)Gene222 Wrote:  You should not use the INPUT command to create a graphic background screen. The INPUT command stops or pauses program execution, so you can't write text over the INPUT screen using TEXTOUT_P. The text you are writing in the screens shot is just the edit line for the INPUT textbox for variable D.

If you want to create your own INPUT screen, take a look at the AASHTO-93 1.0 app located on hpcalc.org under HP Prime Science Apps.

Thanks, I have downloaded that app and installed it onto the Virtual Calculator. The program doesn't seem to show up in the Programs part of the connectivity kit. Is there a way to view the contents of the program on a PC?
Find all posts by this user
Quote this message in a reply
04-07-2022, 09:46 PM
Post: #5
RE: Input field removal?
(04-07-2022 02:53 AM)Jacob Wall Wrote:  It appears it is not possible to hide the field completely, like you're trying to do. It is not overly difficult to make your completely custom Input programs, which would give you total control. I can share an example if you're interested.

Yes Jacob, it would be good to see an example if you have one, thanks.
Find all posts by this user
Quote this message in a reply
04-08-2022, 01:36 AM (This post was last modified: 04-10-2022 07:36 PM by Gene222.)
Post: #6
RE: Input field removal?
(04-07-2022 09:06 PM)matalog Wrote:  Thanks, I have downloaded that app and installed it onto the Virtual Calculator. The program doesn't seem to show up in the Programs part of the connectivity kit. Is there a way to view the contents of the program on a PC?

To view the app program, in the Calculator panel, expand the Application Library and double click AASHTO 93. On the left panel click the program tab.

AASHTO 93 was the only input program I could find that had a drop box, touch navigation, and left and right arrow navigation.
Find all posts by this user
Quote this message in a reply
04-11-2022, 02:36 AM
Post: #7
RE: Input field removal?
(04-07-2022 09:46 PM)matalog Wrote:  
(04-07-2022 02:53 AM)Jacob Wall Wrote:  It appears it is not possible to hide the field completely, like you're trying to do. It is not overly difficult to make your completely custom Input programs, which would give you total control. I can share an example if you're interested.

Yes Jacob, it would be good to see an example if you have one, thanks.

The example below is a stripped down version of something I made a while back. It should at the very least show one way of doing it. I had a bunch of other stuff built into it, like clipboard copy/paste, custom input types that a parser would check for, alpha handling and so forth.

Code:
#pragma mode( separator(.,;) integer(h32) )

// support routines
ResetCMD();
DrawHeaderBg();
GetMK_in();
FlushKeysMouse();
ClearMouse();
InputLine();
ResetTExit();
ResetShift();
UpdateCursorPos();
FlashBtn();
FlashMenu();

// global variables
KS_shift,CMD_cursor_pos,CMD_edit_left,CMD_edit_right;
IL_init,IL_title,IL_prompt,IL_help,IL_menu,IL_result,IL_stat;
MK_in,MK_mx,MK_my;
TExit:=10,TExit_count;
main_color:=#000000h,main_bg:=#FFFFFFh,dark_accent:=#FB0000h,title_color:=#FFFFF​Fh,invhi_color:=#FB0000h;
num_keys:={42,43,44,37,38,39,32,33,34,47,48,49,50,45,40,35,29};
num_strings:={"1","2","3","4","5","6","7","8","9","0","."," ","+","-","*","/",","};

EXPORT IL()
BEGIN
  TExit_count:=0;
  IL_init:="123";
  IL_title:="Test Me";
  IL_prompt:="Prompt";
  IL_help:={"Multiple lines","of help text"};
  IF InputLine==1 THEN
    MSGBOX(IL_result);
  END;
END;

ResetCMD()
BEGIN
  KS_shift:=0;
  CMD_cursor_pos:=0;
  CMD_edit_left:="";
  CMD_edit_right:="";
END;

// draw title to header
DrawHeaderBg(title_string)
BEGIN
  RECT_P(G0,0,0,319,18,dark_accent);
  LINE_P(G0,0,19,319,19,main_color);
  TEXTOUT_P(title_string,G0,2,1,3,title_color,270);
END;

GetMK_in()
BEGIN
  IF TExit_count==TExit THEN
    MK_in:=400;
  ELSE
    REPEAT
      IFERR MK_in:=WAIT(-1); THEN
        MK_in:=4;
        FlushKeysMouse();
      END;
    UNTIL TYPE(MK_in)==0 OR IFTE(SIZE(MK_in)>1,MK_in(1)==3,0);
    ClearMouse();
    IF TYPE(MK_in)==6 THEN // list
      MK_mx:=MK_in(2);
      MK_my:=MK_in(3);
      TExit_count:=0;
    END;
  END;
END;

// get all keys and mouse events out of the system
FlushKeysMouse()
BEGIN
  LOCAL j,ksum;
  REPEAT
    ksum:=0;
    FOR j FROM 0 TO 50 DO
      ksum:=ksum+ISKEYDOWN(j);
    END;
  UNTIL ksum==0;
  ClearMouse();
END;

ClearMouse()
BEGIN
  LOCAL m;
  REPEAT
    m:=MOUSE();
  UNTIL SIZE(m(1))==0;
END;

// single line input
// IL_init is initial edit line value
// IL_title is title of input screen
// IL_prompt is the prompt for input text above input line
// IL_help is multiple lines of help text above the prompt
InputLine()
BEGIN
  LOCAL draw_screen:=1,j,exit_IL:=0,max_chars:=32,dim_left,dim_right;
  LOCAL dim_str,start_left,cur_item;
  IL_stat:=0;
  ResetCMD();
  CMD_edit_left:=IL_init;
  IL_menu:={"","","","","Cancel","OK"};
  FlushKeysMouse();
  REPEAT
    IF draw_screen THEN
      DrawHeaderBg(IL_title); // title
      RECT_P(G0,0,20,319,175,main_bg); // help
      FOR j FROM 1 TO SIZE(IL_help) DO
        TEXTOUT_P(IL_help(j),G0,0,40+(j-1)*15,3,main_color,315);
      END;
      RECT_P(G0,0,176,319,195,main_bg); // prompt
      TEXTOUT_P(IL_prompt,G0,0,178,3,invhi_color,315);
      LINE_P(G0,0,196,319,196,invhi_color);
      DRAWMENU(IL_menu);
      draw_screen:=0;
    END;
    RECT_P(G0,277,0,319,18,dark_accent);
    IF KS_shift THEN
      TEXTOUT_P("■S",G0,280,4,2,title_color);
    END;
    RECT_P(G0,0,197,319,219,main_bg);
    dim_left:=MAX({28,32-DIM(CMD_edit_left)});
    dim_right:=MIN({DIM(CMD_edit_right),dim_left});
    dim_left:=MIN({DIM(CMD_edit_left),max_chars-dim_right});
    start_left:=MAX({1,DIM(CMD_edit_left)-dim_left+1});
    CMD_cursor_pos:=TEXTOUT_P(MID(CMD_edit_left,start_left,IFTE(dim_left,dim_le​ft,1)),G0,0,200,4,main_color);
    TEXTOUT_P(CHAR(9615),G0,CMD_cursor_pos,200,4,main_color);
    TEXTOUT_P(MID(CMD_edit_right,1,IFTE(dim_right,dim_right,1)),G0,CMD_cursor_p​os+1,200,4,main_color);
    GetMK_in();
    IF TYPE(MK_in)==0 THEN // keyboard
      IF MK_in==-1 THEN // timeout after 60 seconds
        TExit_count:=TExit_count+1;
      ELSE
        ResetTExit();
        CASE
          IF POS({4,46,400},MK_in) THEN // ESC or ON or TExit timeout
            IL_stat:=0;
            exit_IL:=1;
          END;
          IF MK_in==7 THEN // LEFT CURSOR
           IF KS_shift THEN
             CMD_edit_right:=CMD_edit_left+CMD_edit_right;
             CMD_edit_left:="";
           ELSE
             dim_str:=DIM(CMD_edit_left);
             IF dim_str>1 THEN
               CMD_edit_right:=MID(CMD_edit_left,dim_str)+CMD_edit_right;
               CMD_edit_left:=MID(CMD_edit_left,1,DIM(CMD_edit_left)-1);
             ELSE
               CMD_edit_right:=CMD_edit_left+CMD_edit_right;
               CMD_edit_left:="";
             END;
           END;
          END;
          IF MK_in==8 THEN // RIGHT CURSOR
            IF KS_shift THEN
              CMD_edit_left:=CMD_edit_left+CMD_edit_right;
              CMD_edit_right:="";
             ELSE
              dim_str:=DIM(CMD_edit_right);
              IF dim_str>1 THEN
                CMD_edit_left:=CMD_edit_left+LEFT(CMD_edit_right,1);
                CMD_edit_right:=MID(CMD_edit_right,2);
              ELSE
                CMD_edit_left:=CMD_edit_left+CMD_edit_right;
                CMD_edit_right:="";
              END;
            END;
          END;
          IF MK_in==19 THEN // backspace
            IF KS_shift THEN
              CMD_edit_left:="";
            ELSE
              IF DIM(CMD_edit_left)>1 THEN
                CMD_edit_left:=MID(CMD_edit_left,1,DIM(CMD_edit_left)-1);
              ELSE
                CMD_edit_left:="";
              END;
            END;
          END;
          IF MK_in==30 THEN // ENTER
            IL_result:=CMD_edit_left+CMD_edit_right;
            IL_stat:=1;
            exit_IL:=1;
          END;
          IF MK_in==41 THEN // shift
            KS_shift:=IFTE(KS_shift,0,1);
          END;
          CASE
            IF POS(num_keys,MK_in) THEN
              CMD_edit_left:=CMD_edit_left+num_strings(POS(num_keys,MK_in));
            END;
            IF MK_in==27 THEN
              dim_str:=DIM(CMD_edit_left);
              IF dim_str THEN
                IF LEFT(CMD_edit_left,1)=="−" THEN
                  CMD_edit_left:=IFTE(dim_str>1,MID(CMD_edit_left,2),"");
                ELSE
                  CMD_edit_left:="−"+CMD_edit_left;
                END;
              ELSE
                dim_str:=DIM(CMD_edit_right);
                IF dim_str THEN
                  IF LEFT(CMD_edit_right,1)=="−" THEN
                    CMD_edit_right:=IFTE(dim_str>1,MID(CMD_edit_right,2),"");
                  ELSE
                    CMD_edit_right:="−"+CMD_edit_right;
                  END;
                ELSE
                  CMD_edit_left:="−";
                END;
              END;
            END;
            IF MK_in==28 THEN
              CMD_edit_left:=CMD_edit_left+"(";
              CMD_edit_right:=")"+CMD_edit_right;
            END;
          END;
        END;
        ResetShift();
      END;
    ELSE // touch events
      CASE
        IF 196<MK_my<220 THEN // input area
          UpdateCursorPos(0);
        END;
        IF MK_my>219 THEN // menu
          FlashMenu();
          draw_screen:=1;
          CASE
            IF 264>MK_mx>211 THEN // Cancel
              IL_stat:=0;
              exit_IL:=1;
            END;
            IF MK_mx>264 THEN // OK
              IL_result:=CMD_edit_left+CMD_edit_right;
              exit_IL:=1;
              IL_stat:=1;
            END;
          END;
        END;
      END;
    END;
  UNTIL exit_IL;
  RETURN IL_stat;
END;

ResetTExit()
BEGIN
  IF TYPE(MK_in)==0 THEN
    IF MK_in<>400 THEN
      TExit_count:=0;
    END;
  END;
END;

ResetShift()
BEGIN
  IF TYPE(MK_in)==0 THEN
    IF MK_in<>41 THEN
      KS_shift:=0;
    END;
  END;
END;

UpdateCursorPos(x1)
BEGIN
  LOCAL temp_x;
  CASE
    IF MK_mx<(x1+4) THEN
      CMD_edit_right:=CMD_edit_left+CMD_edit_right;
      CMD_edit_left:="";
    END;
    IF MK_mx<=CMD_cursor_pos THEN
      IF DIM(CMD_edit_left) THEN
        REPEAT
          CMD_edit_right:=RIGHT(CMD_edit_left,1)+CMD_edit_right;
          IF DIM(CMD_edit_left)>1 THEN
            CMD_edit_left:=MID(CMD_edit_left,1,DIM(CMD_edit_left)-1);
          ELSE
            CMD_edit_left:="";
          END;
          temp_x:=TEXTOUT_P(CMD_edit_left,G9,x1,0,5)+1;
        UNTIL (temp_x<=MK_mx) OR (DIM(CMD_edit_left)==0);
      END;
    END;
    IF MK_mx>CMD_cursor_pos THEN
      IF DIM(CMD_edit_right) THEN
        REPEAT
          CMD_edit_left:=CMD_edit_left+LEFT(CMD_edit_right,1);
          IF DIM(CMD_edit_right)>1 THEN
            CMD_edit_right:=MID(CMD_edit_right,2);
          ELSE
            CMD_edit_right:="";
          END;
          temp_x:=TEXTOUT_P(CMD_edit_left,G9,x1,0,5)+1;
        UNTIL (temp_x>=MK_mx) OR (DIM(CMD_edit_right)==0);
      END;
    END;
  END;
END;

FlashBtn(indx)
BEGIN
  LOCAL x1:={0,52,105,158,211,264},x2:={52,105,158,211,264,319};
  INVERT_P(G0,x1(indx),219,x2(indx),239);
  WAIT(0.1);
END;

FlashMenu()
BEGIN
  CASE
    IF MK_mx<52 THEN
      FlashBtn(1);
    END;
    IF 105>MK_mx>52 THEN
      FlashBtn(2);
    END;
    IF 158>MK_mx>105 THEN
      FlashBtn(3);
    END;
    IF 211>MK_mx>158 THEN
      FlashBtn(4);
    END;
    IF 264>MK_mx>211 THEN
      FlashBtn(5);
    END;
    IF MK_mx>264 THEN
      FlashBtn(6);
    END;
  END;
END;
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 2 Guest(s)