Pages: [1] 2   Go Down
Author Topic: Phi_prompt new release teaser - scrolling list items  (Read 2123 times)
0 Members and 1 Guest are viewing this topic.
Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

UPDATE:
This is a new render option for list. The highlighted list item is always centered while the list scrolls up and down at button push:


UPDATE:
Here is another teaser showing off scrolling text areas using phi_prompt library that I will release soon. The text area can be any size and be displayed anywhere (no clipping on the display edge!). You also have the option to sacrifice a whole column of characters to display a DOS-looking scroll bar, tailored to the size of your text area and text length! Here you go mowcius!

The top line is just a fixed text output so it doesn't scroll.



ORIGINAL POST
I'm getting phi_prompt ready for a new release with the below additions:

  •    Support 20X4 character screen with more flexible “2X2″ list mode so you can list M columns by N rows with X  characters per row, all M, N, and X are your choice (Done)
  •    List your “2X2″ list anywhere on a larger screen instead of the basic 16X2 screen (Done)
  •    Easy to call “YES/NO” dialog.(Done)
  •    Easy to display “YES/NO”, “HIGH/LOW” options for numerical inputs so you don’t have to construct a list and do it the list way.(Planning)
  •    Add scrolling texts that scrolls to fit in smaller space (Done)
  •    Add floating point number input (Done)
  •    Add event function so each time the user changes a number, a function is called to update operations (planning)
  •    Add dialog functions to make a dialog. This function creates a complete dialog with various controls and the user uses left and right keys to navigate among the controls and change their values. It is going to look like a dialog on your computer. You make some choices and push yes. (planning)
  •    Add multi-line text display. (Done)

The new release will give developers freedom to display lists in m columns by n rows, and customize lists in other rendering modes. It also features auto-scrolling list items for items too long to fit in. See the teaser video below.



« Last Edit: May 20, 2011, 10:36:45 pm by liudr » Logged


Rome - Italy
Offline Offline
Full Member
***
Karma: 2
Posts: 246
Arduino UNO "Noob" User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

italian food is the best one  smiley-mr-green
Logged

Tennessee
Offline Offline
Newbie
*
Karma: 0
Posts: 22
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool stuff!  #subscribed

Learning this stuff has made me REALLY respect the guys who develop stuff like smartphones.  I used to brag on how much I knew electronics... I dont do that anymore.  Nothing like being a noob with 20 years experience.  smiley-cool
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

italian food is the best one  smiley-mr-green

I don't know all those shapes but they're all good with the right sauce and meat/shrimp.  smiley

I also tried to auto scroll all items that are too long but that started to look silly and distracting so I am only scrolling the highlighted item. No time for pasta today. It's going to be wraps.
Logged


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool stuff!  #subscribed

Learning this stuff has made me REALLY respect the guys who develop stuff like smartphones.  I used to brag on how much I knew electronics... I dont do that anymore.  Nothing like being a noob with 20 years experience.  smiley-cool

Thanks. I will make an effort to expand these features to GLCD this summer. character LCDs are good for basic display but you can't do too much interaction as there's no space. I will also see if I can incorporate a number pad as optional input beside the one I'm using.
Logged


Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

New features are added: scrolling text area and yes/no dialog. See OP for the video or here:

Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Neat! smiley-grin
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Neat! smiley-grin

Thanks mowcius. Once I am happy enough to release what I wrote recently, I can move on to port the functions to GLCD. This will be really interesting and even more useful.
Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd be interested to have a look at what you wrote for the scrolling text function - got a couple of ideas that I'd like to try with the scroll bar.
Logged

Norway
Offline Offline
Sr. Member
****
Karma: 4
Posts: 423
microscopic quantum convulsions of space-time
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nice! Also nice touch with the scrollbar there! smiley
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I'd be interested to have a look at what you wrote for the scrolling text function - got a couple of ideas that I'd like to try with the scroll bar.
mowcius, here they are:

1. The function that renders "long message", so displaying (including scroll bar) is done here:

Code:
void long_msg_lcd(phi_prompt_struct* para)
{
  byte columns=para->step.i/100, rows=para->step.i%100, ch;
  if (para->low.i>=strlen(para->ptr.msg)) ch=0;
  else ch=para->ptr.msg[para->low.i];
  for (byte i=0;i<rows;i++)
  {
    lcd->setCursor(para->col,para->row+i);
    for (byte j=0;j<columns;j++)
    {
      if (ch==0) lcd->write(' ');
      else
      {
        lcd->write(ch);
        ch=para->ptr.msg[para->low.i+i*columns+j+1];
      }
    }
  }
  if (para->option==1)
  {
    byte location=int((((float)para->low.i)/strlen(para->ptr.msg)*(rows*2-2)));
    for (byte i=0;i<rows;i++)
    {
      lcd->setCursor(para->col+columns,para->row+i);
      if (i==0)
      {
        if (location==0) lcd->write(0);
        else lcd->write(1);
      }
     
      else if (i==rows-1)
      {
        if (location==(rows*2-2-1)) lcd->write(5);
        else lcd->write(4);
      }

      else if ((location+1)/2==i)
      {
        if ((location-1)/2*2==location-1) lcd->write(2);
        else lcd->write(3);
      }
      else lcd->write(' ');
     
    }
  }
}


2. This function interacts with the user (via keypad call wait_on_escape and lcd via the long_message function) so scrolling is done here:
The reason I called this function text area is to correspond to Java's text area to display text.
Code:
int text_area(phi_prompt_struct *para)
{
  byte columns=para->step.i/100, rows=para->step.i%100, ch;
  long_msg_lcd(para);
  while(true)
  {
    byte temp1=wait_on_escape(50);
    switch (temp1)
    {
      case 1:
      if (para->low.i+columns<para->high.i)
      {
        para->low.i+=columns;
        long_msg_lcd(para);
      }
      break;
     
      case 2:
      if (para->low.i-columns>=0)
      {
        para->low.i-=columns;
        long_msg_lcd(para);
      }
      break;
      case 3: // Left is pressed
      return(-3);
      break;
     
      case 4: // Right is pressed
      return(-4);
      break;
     
      case 5: // Enter is pressed
      return(1);
      break;
     
      case 6: // Escape is pressed
      return (-1);
      break;
     
      default:
      break;
    }
  }
}


3. Here's the struct in case you need it to understand the code:
It tells you what each field holds besides comments inline with the code.
Code:
union buffer_pointer
{
int *i_buffer;
float * f_buffer;
char ** list;
char* msg;
};

union four_bytes
{
int i;
long l;
float f;
byte b;
char c;
};

struct phi_prompt_struct
{
  buffer_pointer ptr;
  four_bytes low; // Lower limit for text panel (.c), integers (.i) and floats (.f) and default item for list (.i)
  four_bytes high; // Upper limit for text panel (.c), integers (.i) and floats (.f) and last item for list (.i)
  four_bytes step;// Step size for integers (.i) and integer/decimal for floats (.i), such as 302 means 3 digits before decimal and 2 digits after.
  byte col; // Which column to display input
  byte row; // Which row to display input
  byte width; // Maximal number of character on integers, floats, a list item, and total allowed input characters for text panel
  int option; // What display options to choose
//  LiquidCrystal *lcd; // Which display to use. Removed in second release
//  phi_buttons **btns; // Which series of buttons to use. Removed in second release
  void (*update_function)(phi_prompt_struct *); // This is not being used in this version but reserved for future releases.
}; //22 bytes


Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh I am still here by the way - just haven't had chance to test this yet. It's on my list smiley
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Oh I am still here by the way - just haven't had chance to test this yet. It's on my list smiley

I'll post the new library that includes all these and example code. Everything I planned for will either get released or wait for the next release. I feel like back in the early 90's programming in DOS except I am no longer using ASM, which is good for my age.
Logged


North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool - I'll have a play then. I fancy a scrolling menu too smiley I've got one half coded here somewhere.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 64
Posts: 6886
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Cool - I'll have a play then. I fancy a scrolling menu too smiley I've got one half coded here somewhere.

Do you mean a menu with highlighted item always in the middle and a key press scrolls all contents up or down one line at a time, instead of the following?

Logged


Pages: [1] 2   Go Up
Jump to: