Announcement

Collapse
No announcement yet.

Calling a keyboard using KBFunc

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling a keyboard using KBFunc

    Hi Folks:

    I have a question about one of the examples, KBFunc. I am using a uLCD-28-PT and want to create a program that I can use to call up a keyboard to give the user a way to customize some of the Headers in my Main program. The called program would create a string and save it to flash so the main program could use it. The program KBFunc seems to do just that, however I can't figure out how to call it. I am confused by the following statement in the comments:
    Called with
    *
    * p1 : Heading, string pointer to heading
    * p2 : Response, string pointer area to receive typed response
    * p3 : Maxlen, maximum length of Response
    * p4 : SaveScreen, 1 means current screen will be saved and restored on exit

    I believe that these pointers point to each of the variables that are declared in the main(). But how do I ask for p2 to be saved under a variable that I can use in the main. Header1 := p2. Do I send a variable to the called program using the args() statement, for example: file_Exec("KBFunc.4fn",args); ?

    once again, thank you for your help, your help has been greatly appreciated.

    Mark

  • #2

    Hopefully this will help it make sense
    #platform "uLCD-32PTU"
    #inherit "4DGL_16bitColours.fnc"

    var popup ;
    var mssg[20] ;
    var resp[20] ;

    func main()
    var r ;
    if (!file_Mount())
    while(!file_Mount())
    putstr("Drive not mounted...");
    pause(200);
    gfx_Cls();
    pause(200);
    wend
    endif

    popup := file_LoadFunction("KBFUNC.4FN");

    if(popup)
    to(mssg) ;
    print("Type something") ;
    r := popup(str_Ptr(mssg), str_Ptr(resp), 40, 1);
    gfx_ScreenMode(PORTRAIT) ;
    gfx_MoveTo(30,100) ;
    txt_FGcolour(LIME) ;
    mem_Free(popup);
    print("You typed\n'", [STR] resp, "'\nIt is ", r, " Chars long") ;
    else
    print("KBfunc.4fn not found!\n") ;
    endif

    repeat forever

    endfunc

    Mark

    Comment


    • #3


      Thank you for your quick reply, I have a better understanding now.

      Mark

      Comment

      Working...
      X