Seite 1 von 1

GUIDemo von parallax für den HIVE Umsetzen

Verfasst: Mi 30. Dez 2015, 05:42
von PIC18F2550
Hallo,

ich habe versucht die GUI http://obex.parallax.com/object/595 auf deutsch umzustellen.

VGA-Treiber wurde auf 256 Zeichen erweitert
Keyb-Treiber ist der bel-keyb.spin.

Beide Treiber arbeiten richtig und wurden auch schon in andere Projekte erfolgreich eingesetzt.

Die GUI nimmt aber nur Kleinbuchstaben entgegen.
Bei Grossbuchstaben verhält sie sich als wenn nichts eingegeben wurde.

In menuitem.spin habe ich bei der Ausgabe DrawText(pMode) den Inversmodus entfernt.
Aber irgendwo wird das 8 Bit im Zeichencode noch Bearbeitet, ich kann aber die Stelle nicht finden.

Code: Alles auswählen

  '---------------------------------------------------------------------------
  'Handle Keyboard input
  '---------------------------------------------------------------------------

  if KEYB.gotkey
    idx := INPF[liveINPF].get_gzidx
    if gz_elem[idx] & G_INIT == G_INIT          'is it set
      tmp := INPF[liveINPF].Handler(KEYB.key) '<<----------
      if tmp & $80000000
        retVal := INPF[liveINPF].get_gzidx      'if enter was pressed

  return retVal

Code: Alles auswählen

PUB Handler( pKeyCode ) | retVal, vgaIdx
'Handles key codes for a basic one line input field intended for simple data
'or commands (it is not a text editor :-)). The control uses the screen as a
'buffer so no extra memory is required to pass back the data to the caller.
'When the user presses enter a return value is bitfield encoded containing
'the address and size of the text entered. The caller then must get or use the
'data entered and then call the CLEAR method to reset the input field.
'
' returns 0       = ok, no action required
'         1       = not selected
'         MSB set = enter pressed, caller to read string and clear field
'                   Returned word is bitfield encoded to return the address
'                   and size of the string entered. Encoded as follows:
'                       %100a_aaaa_aaaa_aaaa_0000_0000_ssss_ssss
'                          a = 13bit address  s = 8 bit size
'
  retVal := 0  
  vgaIdx := varVgaPos + varColIdx

  if varStatus == 0
    retVal := 1
  else
    case pKeyCode
      $0D:                                      'carriage return
        retval := $80000000                     ' set MSB

      $C8:                                      'backspace
        if ( varColIdx )
          vgaIdx--
          varColIdx--
          varCursorCol--
          byte[varScreenPtr][vgaIdx] := " "
          byte[varCxPtr][0] := varCursorCol     'move text cursor
 
      $20 .. $FF:                               'standard ASCII characters
        if varColIdx < varWidth - 3 - varTitleWidth
          byte[varScreenPtr][vgaIdx] := pKeyCode
          varColIdx++
          varCursorCol++
          byte[varCxPtr][0] := varCursorCol     'move text cursor
  return retVal

<<---------- Diese stelle bringt bei Grossbuchstaben scheinbar keinen Wert Zurück



EDIT
Die Zeile abändern in

Code: Alles auswählen

      tmp := INPF[liveINPF].Handler(KEYB.key & $FF)
Jetzt sind bis auf das "Ö" auch die Grossbuchstaben vorhanden.

Die Tasten F7 und Ö haben beide die Codierung $D6

Re: GUIDemo von parallax

Verfasst: Mi 30. Dez 2015, 22:17
von PIC18F2550
Heute mal etwas näher Betrachtet.
Die Lösung liegt in der "InputField.spin"
ich habe diese einfach etwas Umgestrickt.

Code: Alles auswählen

PUB Handler( pKeyCode ) | retVal, vgaIdx
'Handles key codes for a basic one line input field intended for simple data
'or commands (it is not a text editor :-)). The control uses the screen as a
'buffer so no extra memory is required to pass back the data to the caller.
'When the user presses enter a return value is bitfield encoded containing
'the address and size of the text entered. The caller then must get or use the
'data entered and then call the CLEAR method to reset the input field.
'
' returns 0       = ok, no action required
'         1       = not selected
'         MSB set = enter pressed, caller to read string and clear field
'                   Returned word is bitfield encoded to return the address
'                   and size of the string entered. Encoded as follows:
'                       %100a_aaaa_aaaa_aaaa_0000_0000_ssss_ssss
'                          a = 13bit address  s = 8 bit size
'
  retVal := 0  
  vgaIdx := varVgaPos + varColIdx
  if varStatus == 0
    retVal := 1
  else
    case pKeyCode
      $D0:  ' F1
      $D1:  ' F2
      $D2:  ' F3
      $D3:  ' F4
      $D4:  ' F5
      $D5:  ' F6
      $D6:  ' F7
      $D7:  ' F8
      $D8:  ' F9
      $D9:  ' F10
      $DA:  ' F11
      $DB:  ' F12
      other:
        case pKeyCode & $FF
          $0D:                                      'carriage return
            retval := $80000000                     ' set MSB
          $C8:                                      'backspace
            if ( varColIdx )
              vgaIdx--
              varColIdx--
              varCursorCol--
              byte[varScreenPtr][vgaIdx] := " "
              byte[varCxPtr][0] := varCursorCol     'move text cursor
          $20 .. $FF:                               'standard ASCII characters
            if varColIdx < varWidth - 3 - varTitleWidth
              byte[varScreenPtr][vgaIdx] := pKeyCode
              varColIdx++
              varCursorCol++
              byte[varCxPtr][0] := varCursorCol     'move text cursor
  return retVal

Als nächstes kommt die Inversdarstellung drann.
Die Geht mit dem 8. Bit nicht mehr.

Re: GUIDemo von parallax

Verfasst: Mi 30. Dez 2015, 22:58
von PIC18F2550
bei der Inversdarstellung wird in der GUI mit zweierlei Maß gearbeitet.
Also habe ich die erst mal Tot gelegt.
Das Ergebnis kann sich schon mal sehen lassen.
Die Mausfunktion wird dabei nicht beeinflusst.

Bei einem Test mit einer Höheren ZeichenZahl musste ich feststellen das der zeichen Puffer nur 64 Zeichen umfasst.
Den muss ich da wohl auf COLS aufbohren.

Re: GUIDemo von parallax

Verfasst: Mi 30. Dez 2015, 23:06
von PIC18F2550
In GUIDemo.spin einfach

Code: Alles auswählen

CON
  VGACOLS = GUI#VGACOLS
  VGAROWS = GUI#VGAROWS

Code: Alles auswählen

VAR
  byte  strBuf2[VGACOLS]
geändert und schon geht es mit 128 x 64 characters :mrgreen:

Re: GUIDemo von parallax

Verfasst: Do 31. Dez 2015, 20:55
von drohne235
Cool, ich fand die GUI immer interessant. Wenn es brauchbar ist, können wir es ja ins TriOS übernehmen. Dafür bräuchte man ein bzgl. der Grundfunktionen kompatibles Interface zu Regnatix.

Re: GUIDemo von parallax

Verfasst: Do 31. Dez 2015, 22:00
von PIC18F2550
Ja das stimmt.
Das ist ja auch mein 4. Anlauf. ;)
Und diesmal habe ich es geschafft.

Einige Funktionen werde ich noch anpassen müssen.

Zur Zeit läuft alles noch auf einem demobord.

Ich habe bei 128x64 Zeichen noch ca. 1500 longs Platz.
Also erstmal Platz schaffen.

Re: GUIDemo von parallax

Verfasst: Fr 1. Jan 2016, 13:39
von drohne235
Deutsche Umlaute und Einbindung von unserem Keyboardtreiber ist ja schon mal mehr als ich geschafft habe... ;)