Input an einer bestimmten Stelle

Übersicht BlitzBasic Allgemein

Neue Antwort erstellen

 

Paranoide

Betreff: Input an einer bestimmten Stelle

BeitragDo, Okt 27, 2005 2:46
Antworten mit Zitat
Benutzer-Profile anzeigen
Moinsen! Smile

Ich möchte dem Benutzer des Programms an einer bestimmten Position auf dem Bildschirm eine Eingabe machen lassen. Allerdings funktioniert der Input()-Befehl ja nur so, dass der Text, den man eingeben kann, ganz oben links erscheint, wie beim Print-Befehl. Außerdem ist das immer alles auf dem FrontBuffer und ist unabhängig vom DoubleBuffering.
Wie bekomm' ich das nun hin, dass ich meinetwegen mitten auf dem Bildschirm (so Koordinaten 500,400) einen Input() geben kann?!

MfG

Michel

soli

BeitragDo, Okt 27, 2005 4:28
Antworten mit Zitat
Benutzer-Profile anzeigen
Schau hier:
http://www.blitzbase.de/befehle2d/locate.htm
solitaire
 

Paranoide

BeitragDo, Okt 27, 2005 12:40
Antworten mit Zitat
Benutzer-Profile anzeigen
Joa, das hab' ich auch schon gesehen, nur wollte ich DESWEGEN nicht benutzen:

Zitat:
LOCATE funktioniert nur in Blitz2D und Blitz3D. Benutzung wird nicht empfohlen, da es demnächst entfernt wird. Benutze TEXT-Befehl.


Aber ich soll es so machen, ja?

MfG

Michel

Lord_Vader

BeitragDo, Okt 27, 2005 12:43
Antworten mit Zitat
Benutzer-Profile anzeigen
Mit Text x,y,text...
 

dennis13

BeitragDo, Okt 27, 2005 14:43
Antworten mit Zitat
Benutzer-Profile anzeigen
Allso meiner meinung nach kannst du das mit locate machen ich hab da noch keine schlechte erfahrungen gemacht.....

MFG

dennis

Klip

BeitragDo, Okt 27, 2005 15:53
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn es unbedingt Input sein muss, dann spricht auch nichts gegen Locate.

Bestenfalls aber schreibst du eine eigene Input-Routine (im FAQ/Codearchiv findet sich dazu was), die kannst du dann überall anzeigen lassen und das Spiel wird noch nicht einmal angehalten.
 

Florian

BeitragDo, Okt 27, 2005 21:32
Antworten mit Zitat
Benutzer-Profile anzeigen
Code:

Type InputBoxTyp
 Field X1,X2
 Field Y1,Y2

 Field Tab
 Field Status
 Field Cursor
 Field CursorBreit

 Field MarkiertX1
 Field MarkiertX2
 Field Markiert
 Field Text$
 Field MaxLang

 Field CursorFarbe
 Field TextFarbe[1]
 Field HTextFarbe[1]
 
 Field Ins
End Type

Global InputBox.InputBoxTyp

Global Strg
Global Alt
Global Shift
Global AltGr


Global MausUeberInputBox

Global KeyTimer
Global RepeatTime = 100   ;--> Repetierzeit
Global TimeToRepeat = 500 ;--> Zeit bis zum Einsetzen des Repeatiervorgangs

Global Key$

Global MausTaste[3]
Global Groszbuchstaben
Global ClipBoard$=""

Const Aktiv=1
Const inaktiv=2

Graphics 640,480,0,2
SetBuffer BackBuffer()

SetFont LoadFont("Courier New",24,False,False,False)



InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=50
InputBox\X2=400
InputBox\Y2=FontHeight()
InputBox\Text$=""

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=1
InputBox\MaxLang=30

InputBox\Ins=True

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

InputBox\Tab=1

InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=150
InputBox\X2=400
InputBox\Y2=FontHeight()
InputBox\Text$=""

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=1
InputBox\MaxLang=30

InputBox\Ins=True
InputBox\Tab=2

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

InputBox\Status=Aktiv



InputBox=New InputBoxTyp

InputBox\X1=50
InputBox\Y1=250
InputBox\X2=400
InputBox\Y2=FontHeight()
InputBox\Text$=""

InputBox\CursorFarbe=Farbe(0,0,0)
InputBox\Cursor=0
InputBox\MaxLang=30

InputBox\Ins=True
InputBox\Tab=3

InputBox\TextFarbe[0]=Farbe(0,0,0)

InputBox\HTextFarbe[0]=Farbe(255,255,255)

InputBox\CursorBreit=2

InputBox\Status=InAktiv

ClsColor 92,92,92

Timer=CreateTimer(15)

Repeat
 Cls
 Keyboad
 MausUpdate
 Key
 DrawInputBox
 


 Flip
 WaitTimer Timer
Forever




Function Key()
 For InputBox=Each InputBoxTyp
  If InputBox\Status=Aktiv Then

  If Asc(Key$)>31 Then
    If InputBox\Markiert=True Then
      InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
      InputBox\Markiert=False
      InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Key$+Mid$(InputBox\Text,InputBox\MarkiertX1+1)
      InputBox\Cursor=InputBox\MarkiertX1+1
     Else
      If InputBox\MaxLang>Len(InputBox\Text) Then
       If InputBox\Ins=True Then
         If InputBox\Cursor>Len(InputBox\Text) Then
           If InputBox\Cursor<InputBox\MaxLang Then
            InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
            InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+1)
            InputBox\Cursor=InputBox\Cursor+1
           End If 
          Else
           InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+1)
           InputBox\Cursor=InputBox\Cursor+1
         End If
        Else
         If InputBox\Cursor>Len(InputBox\Text) Then
           If InputBox\Cursor<InputBox\MaxLang Then
            InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
            InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+2)
            InputBox\Cursor=InputBox\Cursor+1
           End If
          Else
           InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Key$+Mid$(InputBox\Text,InputBox\Cursor+2)
           InputBox\Cursor=InputBox\Cursor+1
         End If         
       End If
      End If
    End If 
   Else
   
    If Shift=False And Strg=False Then
     Select Asc(Key$)
      Case 1;Pos1
       InputBox\Cursor=0
       InputBox\Markiert=False
      Case 2;Ende
       InputBox\Cursor=Len(InputBox\Text)
       InputBox\Markiert=False
      Case 3;Einfügen
       InputBox\Ins=True-InputBox\Ins
      Case 4;Entf
       If InputBox\Markiert=True Then
         InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
         InputBox\Markiert=False
         InputBox\Cursor=InputBox\MarkiertX1
        Else 
         If Len(InputBox\Text)>InputBox\Cursor Then
          If InputBox\Markiert=True Then   
            InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
            InputBox\Markiert=False
           Else
            InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+Mid$(InputBox\Text,InputBox\Cursor+2)
          End If
         End If
       End If 
      Case 8;Del 

       If InputBox\Markiert=True Then
         InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
         InputBox\Markiert=False
        Else 
         If Len(InputBox\Text)>0 And InputBox\Cursor=>1 And Len(InputBox\Text)-InputBox\Cursor=>0 Then
          InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor-1)+Mid$(InputBox\Text,InputBox\Cursor+1)
          InputBox\Cursor=InputBox\Cursor-1
         ElseIf InputBox\Cursor=>1 Then
          InputBox\Cursor=InputBox\Cursor-1
        End If
       End If
      Case 9 ;Tab

       TabNr=InputBox\Tab
 
       For InputBox=Each InputBoxTyp
       
        If TabNr<InputBox\Tab Then
         If InputBox\Tab<MaxTab Or MaxTab=0 Then
          MaxTab=InputBox\Tab
     
         End If 
        End If
        If InputBox\Tab<TabNr Then
         If MinTab=0 Or MinTab>InputBox\Tab Then 
          minTab=InputBox\Tab
         End If 
        End If 
       Next
       
       If MaxTab<>TabNr And MaxTab<>0 Then
         InputBoxNrNeu=MaxTab
       Else
        InputBoxNrNeu=minTab
       End If
               



       If InputBoxNrNeu>0 Then
        For InputBox=Each InputBoxTyp
         InputBoxZaehler=InputBoxZaehler+1
         If InputBoxNrNeu=InputBoxZaehler Then
           InputBox\Status=Aktiv
          Else
           If InputBox\Status=Aktiv Then
            InputBox\Status=InAktiv
           End If
         End If
        Next
       End If 
       Return

         
      Case 13;Enter

       TabNr=InputBox\Tab
 
       For InputBox=Each InputBoxTyp
       
        If TabNr<InputBox\Tab Then
         If InputBox\Tab<MaxTab Or MaxTab=0 Then
          MaxTab=InputBox\Tab
     
         End If 
        End If
        If InputBox\Tab<TabNr Then
         If MinTab=0 Or MinTab>InputBox\Tab Then 
          minTab=InputBox\Tab
         End If 
        End If 
       Next
       
       If MaxTab<>TabNr And MaxTab<>0 Then
         InputBoxNrNeu=MaxTab
       Else
        InputBoxNrNeu=minTab
       End If
               



       If InputBoxNrNeu>0 Then
        For InputBox=Each InputBoxTyp
         InputBoxZaehler=InputBoxZaehler+1
         If InputBoxNrNeu=InputBoxZaehler Then
           InputBox\Status=Aktiv
          Else
           If InputBox\Status=Aktiv Then
            InputBox\Status=InAktiv
           End If
         End If
        Next
       End If 
       Return

      Case 27;ESC
      Case 31;links
       If InputBox\Cursor>=1 Then
        InputBox\Cursor=InputBox\Cursor-1
       End If
       InputBox\Markiert=False   
      Case 30;rechts
       If InputBox\MaxLang>InputBox\Cursor Then
        InputBox\Cursor=InputBox\Cursor+1
       End If
       InputBox\Markiert=False
      Case 28;Rauf
      Case 29;runter
     End Select
     ElseIf Shift=False And Strg=True Then
 
      If KeyDown(30) Then;Strg+A
       If Len(InputBox\Text)>0 Then
        InputBox\MarkiertX1=0
        InputBox\MarkiertX2=Len(InputBox\Text)
        InputBox\Markiert=True
       End If
      End If
     
      If KeyDown(46) Then ;Strg+C
       If InputBox\Markiert=True Then
        ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
       End If 
      End If
     
      If KeyDown(47) Or KeyDown(210) Then ;Strg+V Strg+Einfg
       If Len(ClipBoard$)>0 Then
        If InputBox\Markiert=True Then
         If -InputBox\MarkiertX2+Len(Mid$(InputBox\Text,1,InputBox\MarkiertX1))+Len(ClipBoard$)+Len(Mid$(InputBox\Text,InputBox\MarkiertX1+1))=<InputBox\MaxLang Then 

          InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
          InputBox\Markiert=False
          InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+ClipBoard$+Mid$(InputBox\Text,InputBox\MarkiertX1+1)
          InputBox\Cursor=InputBox\MarkiertX1+Len(ClipBoard$)

         End If
        ElseIf InputBox\Ins=True Then

         If Len(InputBox\Text)+Len(String$(" ",InputBox\Cursor-Len(InputBox\Text)))+Len(ClipBoard$)=<InputBox\MaxLang Then     
          InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
          InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+ClipBoard$+Mid$(InputBox\Text,InputBox\Cursor+1)
          InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
         End If   
        Else
         If InputBox\Cursor>Len(InputBox\Text) Then
           If Len(InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text)))=<InputBox\MaxLang Then   
            InputBox\Text=InputBox\Text+String$(" ",InputBox\Cursor-Len(InputBox\Text))
            InputBox\Text=InputBox\Text+ClipBoard$
            InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
           End If 
          Else
           If Len(Mid$(InputBox\Text,1,InputBox\Cursor))+Len(ClipBoard$)+Len(Mid$(InputBox\Text,InputBox\Cursor+Len(ClipBoard$)))=<InputBox\MaxLang Then
            InputBox\Text=Mid$(InputBox\Text,1,InputBox\Cursor)+ClipBoard$+Mid$(InputBox\Text,InputBox\Cursor+Len(ClipBoard$))
            InputBox\Cursor=InputBox\Cursor+Len(ClipBoard$)
           End If
         End If     
        End If 
       End If 
      End If

      If KeyDown(45) Then;Strg+X
       If InputBox\Markiert=True Then     
        ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
        InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
        InputBox\Markiert=False
       End If
      End If

         
      If KeyDown(203) Then ;Strg+links
       Leerzeichen=False
       InputBox\Markiert=False
       If InputBox\Cursor>Len(InputBox\Text) Then
        InputBox\Cursor=Len(InputBox\Text)
       End If

       If InputBox\Cursor>0 Then
        For Pos=InputBox\Cursor-1 To 1 Step -1
         If Mid$(InputBox\Text,Pos,1)=" " Then
           Leerzeichen=True 
          Else
           If Leerzeichen=True Then
            Exit
           End If 
         End If
        Next
       End If
       InputBox\Cursor=Pos
      End If 

      If KeyDown(205) Then ;Strg+rechts
       InputBox\Markiert=False
       If InputBox\Cursor>Len(InputBox\Text) Then
        InputBox\Cursor=Len(InputBox\Text)
       End If
     
       If InputBox\Cursor<Len(InputBox\Text) Then
        For Pos=InputBox\Cursor+1 To Len(InputBox\Text)
         If Mid$(InputBox\Text,Pos,1)=" " Then
           Leerzeichen=True 
          Else
           If Leerzeichen=True Then
            Exit
           End If 
         End If
        Next
        InputBox\Cursor=Pos-1
       End If 
      End If
     
     If KeyHit(21) Then

     End If   

     ElseIf Shift=True  And Strg=False Then
 
      If KeyDown(205) Then ;Shift+rechts
       If InputBox\Markiert=True Then
         If InputBox\MarkiertX1<InputBox\Cursor Then
           InputBox\MarkiertX1=InputBox\MarkiertX1+1
           InputBox\MarkiertX2=InputBox\MarkiertX2-1
           If InputBox\MarkiertX2=0 Then InputBox\Markiert=False   
          Else   
           If InputBox\MarkiertX1+InputBox\MarkiertX2<Len(InputBox\Text) Then
            InputBox\MarkiertX2=InputBox\MarkiertX2+1
           End If
         End If 
        Else
         If InputBox\Cursor=<Len(InputBox\Text) Then
          InputBox\Markiert=True
          InputBox\MarkiertX1=InputBox\Cursor
          InputBox\MarkiertX2=1
         End If   
       End If
      End If

      If KeyDown(203) Then ;Shift+links
       If InputBox\Markiert=True Then
         If InputBox\MarkiertX1=>InputBox\Cursor Then
           InputBox\MarkiertX2=InputBox\MarkiertX2-1
           If InputBox\MarkiertX2=0 Then InputBox\Markiert=False
          Else 
           If InputBox\MarkiertX1>0 Then
            InputBox\MarkiertX1=InputBox\MarkiertX1-1
            InputBox\MarkiertX2=InputBox\MarkiertX2+1
           End If
         End If         
        Else
         If InputBox\Cursor=<Len(InputBox\Text) Then
          InputBox\Markiert=True
          InputBox\MarkiertX1=InputBox\Cursor-1
          InputBox\MarkiertX2=1
         End If
       End If   
      End If 

      If Asc(Key$)=1 And  InputBox\Cursor>0 Then ;Shift+Pos1
       If InputBox\Cursor<=Len(InputBox\Text) Then
         InputBox\Markiert=True
         InputBox\MarkiertX1=0
         InputBox\MarkiertX2=InputBox\Cursor
        Else
         InputBox\Markiert=True
         InputBox\MarkiertX1=0
         InputBox\MarkiertX2=Len(InputBox\Text)
       End If 
      End If 

      If Asc(Key$)=2 Then ;Shift+Ende
       If InputBox\Cursor<Len(InputBox\Text) Then
        InputBox\Markiert=True
        InputBox\MarkiertX1=InputBox\Cursor
        InputBox\MarkiertX2=Len(InputBox\Text)-InputBox\Cursor
       End If 
      End If 

      If KeyDown(4);Shift+Entf
       If InputBox\Markiert=True Then     
        ClipBoard$=Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
        InputBox\Text=Mid$(InputBox\Text,1,InputBox\MarkiertX1)+Mid$(InputBox\Text,InputBox\MarkiertX2+InputBox\MarkiertX1+1)
        InputBox\Markiert=False
       End If
      End If


     ElseIf Shift=True  And Strg=True Then


     
      If KeyDown(203) Then ;Shift+Strg+links
       Leerzeichen=False
       If InputBox\Markiert=True Then
         If InputBox\MarkiertX1=>InputBox\Cursor Then
            MarkiertPos=InputBox\MarkiertX2+InputBox\MarkiertX1
            For Pos=MarkiertPos-1 To 1 Step -1
             If Mid$(InputBox\Text,Pos,1)=" " Then
               Leerzeichen=True 
              Else
               If Leerzeichen=True Then
                Exit
              End If 
             End If
            Next               
            If Pos<=InputBox\Cursor Then
               
               InputBox\Markiert=False
         
             Else
              InputBox\MarkiertX2=Pos-InputBox\MarkiertX1
              If InputBox\MarkiertX2=<0 Then InputBox\Markiert=False
            End If               
         
           Else
            If InputBox\MarkiertX1>0 Then   
             MarkiertPos=InputBox\MarkiertX1
             For Pos=MarkiertPos-1 To 1 Step -1
              If Mid$(InputBox\Text,Pos,1)=" " Then
                Leerzeichen=True 
               Else
                If Leerzeichen=True Then
                 Exit
                End If 
              End If
             Next 
             InputBox\MarkiertX1=Pos
             InputBox\MarkiertX2=MarkiertPos-Pos+InputBox\MarkiertX2
   
            End If
         End If 
        Else
         If Len(InputBox\Text)>0 And InputBox\Cursor>0 Then 
          If InputBox\Cursor>Len(InputBox\Text) Then
            MarkiertPos=Len(InputBox\Text) 
           Else
            MarkiertPos=InputBox\Cursor
          End If
          For Pos=MarkiertPos-1 To 1 Step -1
           If Mid$(InputBox\Text,Pos,1)=" " Then
             Leerzeichen=True 
            Else
             If Leerzeichen=True Then
              Exit
             End If 
           End If
          Next 
          InputBox\MarkiertX1=Pos
          InputBox\MarkiertX2=MarkiertPos-Pos
          InputBox\Markiert=True
 
         End If   
       End If
      End If

      If KeyDown(205) Then ;rechts
       Leerzeichen=False
       If InputBox\Markiert=True Then
         If InputBox\MarkiertX1<InputBox\Cursor Then 


           MarkiertPos=InputBox\MarkiertX1
           For Pos=MarkiertPos+1 To Len(InputBox\Text)
             If Mid$(InputBox\Text,Pos,1)=" " Then
               Leerzeichen=True 
              Else
               If Leerzeichen=True Then
                Exit
               End If 
             End If
            Next
            InputBox\MarkiertX2=InputBox\MarkiertX2-(Pos-InputBox\MarkiertX1)+1
            InputBox\MarkiertX1=Pos-1
            If InputBox\MarkiertX2=<0 Then InputBox\Markiert=False
          Else   
           MarkiertPos=InputBox\MarkiertX1+InputBox\MarkiertX2
                     
           If MarkiertPos<=Len(InputBox\Text) Then
                     
            For Pos=MarkiertPos+1 To Len(InputBox\Text)
             If Mid$(InputBox\Text,Pos,1)=" " Then
               Leerzeichen=True 
              Else
               If Leerzeichen=True Then
                Exit
               End If 
             End If
            Next
            InputBox\MarkiertX2=Pos-InputBox\MarkiertX1-1                     
           End If
         End If   
        Else
                 
         If InputBox\Cursor<=Len(InputBox\Text) Then
          For Pos=InputBox\Cursor+1 To Len(InputBox\Text)
           If Mid$(InputBox\Text,Pos,1)=" " Then
             Leerzeichen=True 
            Else
             If Leerzeichen=True Then
              Exit
             End If 
           End If
          Next
          InputBox\MarkiertX1=InputBox\Cursor
          InputBox\MarkiertX2=Pos-inputBox\Cursor-1
          InputBox\Markiert=True
       
         End If   
       End If   
      End If
 
           
    End If
  End If
  End If
 Next   
End Function

Function Keyboad()
 Strg=False
 Alt=False
 Shift=False
 AltGr=False
 Key$=""

 If KeyDown(42)=True Or KeyDown(54)=True Then Shift=True
 If KeyDown(157)=True Or KeyDown(29)=True Then Strg=True
 If KeyDown(56)=True  Then Alt=True
 If KeyDown(184)=True Then AltGr=True





 Key$=Chr$(GetKey())

 If Key$=Chr$(127) Then key$=""
 
 If KeyHit(48)=True And Shift=True And Strg=True Then
  Groszbuchstaben=True - Groszbuchstaben
 End If




 If Key$=Chr$(0) Then
   If KeyTimer<MilliSecs() Then
    KeyTimer=MilliSecs()+RepeatTime
    ;--> Ziffernblock
    If KeyHit(82)  Then Key$="0"         ;0
    If KeyHit(79)  Then Key$="1"         ;1
    If KeyHit(80)  Then Key$="2"         ;2
    If KeyHit(81)  Then Key$="3"         ;3
    If KeyHit(75)  Then Key$="4"         ;4
    If KeyHit(76)  Then Key$="5"         ;5
    If KeyHit(77)  Then Key$="6"         ;6
    If KeyHit(71)  Then Key$="7"         ;7
    If KeyHit(72)  Then Key$="8"         ;8
    If KeyHit(73)  Then Key$="9"         ;9
    If KeyHit(181) Then Key$="/"         ;/
    If KeyHit(55)  Then Key$="*"         ;*
    If KeyHit(74)  Then Key$="-"         ;-
    If KeyHit(78)  Then Key$="+"         ;+
    If KeyHit(83)  Then Key$=","         ;,


    ;--> Cursortasten
   

    If KeyDown(28) Then Key$=Chr$(13)     ;Enter
    If KeyDown(1)  Then Key$=Chr$(27)     ;ESC
    If KeyDown(15)  Then Key$=Chr$(9)     ;Tab

    If KeyDown(210) Then Key$=Chr$(3)     ;Einfügen
    If KeyDown(207) Then Key$=Chr$(2)     ;Ende
    If KeyDown(199) Then Key$=Chr$(1)     ;Pos1
    If KeyDown(200) Then Key$=Chr$(28)    ;rauf
    If KeyDown(208) Then Key$=Chr$(29)    ;runter
    If KeyDown(203) Then Key$=Chr$(31)    ;links
    If KeyDown(205) Then Key$=Chr$(30)    ;rechts
    If KeyDown(211) Then Key$=Chr$(4)     ;Entf
 
    ;--> Steuertasten
    If KeyDown(57)  Then Key$=" "         ;Leertaste
    If KeyDown(14)  Then Key$=Chr$(8)     ;Del


    If Strg=True Then

      If AltGr=True Then

       If KeyDown(11)  Then Key$="}"      ;}
       If KeyDown(3)   Then Key$="²"      ;²
       If KeyDown(4)   Then Key$="³"      ;³
       If KeyDown(8)   Then Key$="{"      ;{
       If KeyDown(9)   Then Key$="["      ;[
       If KeyDown(10)  Then Key$="]"      ;]
       If KeyDown(12)  Then Key$="\"      ;\
       If KeyDown(16)  Then Key$="@"      ;@
       If KeyDown(27)  Then Key$="~"      ;~
       If KeyDown(86)  Then Key$="|"      ;|
       If KeyDown(18)  Then Key$="€"      ;Euro
       If KeyDown(50)  Then Key$="µ"      ;µ
      End If
     Else
      If Shift=True Then

        If KeyDown(11)  Then Key$="="      ;=
        If KeyDown(2)   Then Key$="!"      ;!
        If KeyDown(3)   Then Key$=Chr$(34) ;"
        If KeyDown(4)   Then Key$="§"      ;§
        If KeyDown(5)   Then Key$="$"      ;$
        If KeyDown(6)   Then Key$="%"      ;%
        If KeyDown(7)   Then Key$="&"      ;&
        If KeyDown(8)   Then Key$="/"      ;/
        If KeyDown(9)   Then Key$="("      ;(
        If KeyDown(10)  Then Key$=")"      ;)

        If KeyDown(30)  Then Key$="A"      ;A
        If KeyDown(48)  Then Key$="B"      ;B
        If KeyDown(46)  Then Key$="C"      ;C
        If KeyDown(32)  Then Key$="D"      ;D
        If KeyDown(18)  Then Key$="E"      ;E
        If KeyDown(33)  Then Key$="F"      ;F
        If KeyDown(34)  Then Key$="G"      ;G
        If KeyDown(35)  Then Key$="H"      ;H
        If KeyDown(23)  Then Key$="I"      ;I
        If KeyDown(36)  Then Key$="J"      ;J
        If KeyDown(37)  Then Key$="K"      ;K
        If KeyDown(38)  Then Key$="L"      ;L
        If KeyDown(50)  Then Key$="M"      ;M
        If KeyDown(49)  Then Key$="N"      ;N
        If KeyDown(24)  Then Key$="O"      ;O
        If KeyDown(25)  Then Key$="P"      ;P
        If KeyDown(16)  Then Key$="Q"      ;Q
        If KeyDown(19)  Then Key$="R"      ;R
        If KeyDown(31)  Then Key$="S"      ;S
        If KeyDown(20)  Then Key$="T"      ;T
        If KeyDown(22)  Then Key$="U"      ;U
        If KeyDown(47)  Then Key$="V"      ;V
        If KeyDown(17)  Then Key$="W"      ;W
        If KeyDown(45)  Then Key$="X"      ;X
        If KeyDown(44)  Then Key$="Y"      ;Y
        If KeyDown(21)  Then Key$="Z"      ;Z
        If KeyDown(40)  Then Key$="Ä"      ;Ä
        If KeyDown(39)  Then Key$="Ö"      ;Ö
        If KeyDown(26)  Then Key$="Ü"      ;Ü
        If KeyDown(12)  Then Key$="?"      ;?

        If KeyDown(13)  Then Key$="`"      ;`
        If KeyDown(86)  Then Key$=">"      ;>
        If KeyDown(51)  Then Key$=";"      ;;
        If KeyDown(52)  Then Key$=":"      ;:
        If KeyDown(53)  Then Key$="_"      ;_
        If KeyDown(43)  Then Key$="'"      ;'
        If KeyDown(41)  Then Key$="°"      ;°
        If KeyDown(27)  Then Key$="*"      ;*

       Else

        ;--> Ziffernblock
        If KeyDown(82)  Then Key$="0"      ;0
        If KeyDown(79)  Then Key$="1"      ;1
        If KeyDown(80)  Then Key$="2"      ;2
        If KeyDown(81)  Then Key$="3"      ;3
        If KeyDown(75)  Then Key$="4"      ;4
        If KeyDown(76)  Then Key$="5"      ;5
        If KeyDown(77)  Then Key$="6"      ;6
        If KeyDown(71)  Then Key$="7"      ;7
        If KeyDown(72)  Then Key$="8"      ;8
        If KeyDown(73)  Then Key$="9"      ;9
        If KeyDown(181) Then Key$="/"      ;/
        If KeyDown(55)  Then Key$="*"      ;*
        If KeyDown(74)  Then Key$="-"      ;-
        If KeyDown(78)  Then Key$="+"      ;+
        If KeyDown(83)  Then Key$=","      ;,


        If Groszbuchstaben=True Then

          If KeyDown(30)  Then Key$="A"    ;A
          If KeyDown(48)  Then Key$="B"    ;B
          If KeyDown(46)  Then Key$="C"    ;C
          If KeyDown(32)  Then Key$="D"    ;D
          If KeyDown(18)  Then Key$="E"    ;E
          If KeyDown(33)  Then Key$="F"    ;F
          If KeyDown(34)  Then Key$="G"    ;G
          If KeyDown(35)  Then Key$="H"    ;H
          If KeyDown(23)  Then Key$="I"    ;I
          If KeyDown(36)  Then Key$="J"    ;J
          If KeyDown(37)  Then Key$="K"    ;K
          If KeyDown(38)  Then Key$="L"    ;L
          If KeyDown(50)  Then Key$="M"    ;M
          If KeyDown(49)  Then Key$="N"    ;N
          If KeyDown(24)  Then Key$="O"    ;O
          If KeyDown(25)  Then Key$="P"    ;P
          If KeyDown(16)  Then Key$="Q"    ;Q
          If KeyDown(19)  Then Key$="R"    ;R
          If KeyDown(31)  Then Key$="S"    ;S
          If KeyDown(20)  Then Key$="T"    ;T
          If KeyDown(22)  Then Key$="U"    ;U
          If KeyDown(47)  Then Key$="V"    ;V
          If KeyDown(17)  Then Key$="W"    ;W
          If KeyDown(45)  Then Key$="X"    ;X
          If KeyDown(44)  Then Key$="Y"    ;Y
          If KeyDown(21)  Then Key$="Z"    ;Z
          If KeyDown(40)  Then Key$="Ä"    ;Ä
          If KeyDown(39)  Then Key$="Ö"    ;Ö
          If KeyDown(26)  Then Key$="Ü"    ;Ü

         Else

          If KeyDown(30)  Then Key$="a"    ;a
          If KeyDown(48)  Then Key$="b"    ;b
          If KeyDown(46)  Then Key$="c"    ;c
          If KeyDown(32)  Then Key$="d"    ;d
          If KeyDown(18)  Then Key$="e"    ;e
          If KeyDown(33)  Then Key$="f"    ;f
          If KeyDown(34)  Then Key$="g"    ;g
          If KeyDown(35)  Then Key$="h"    ;h
          If KeyDown(23)  Then Key$="i"    ;i
          If KeyDown(36)  Then Key$="j"    ;j
          If KeyDown(37)  Then Key$="k"    ;k
          If KeyDown(38)  Then Key$="l"    ;l
          If KeyDown(50)  Then Key$="m"    ;m
          If KeyDown(49)  Then Key$="n"    ;n
          If KeyDown(24)  Then Key$="o"    ;o
          If KeyDown(25)  Then Key$="p"    ;p
          If KeyDown(16)  Then Key$="q"    ;q
          If KeyDown(19)  Then Key$="r"    ;r
          If KeyDown(31)  Then Key$="s"    ;s
          If KeyDown(20)  Then Key$="t"    ;t
          If KeyDown(22)  Then Key$="u"    ;u
          If KeyDown(47)  Then Key$="v"    ;v
          If KeyDown(17)  Then Key$="w"    ;w
          If KeyDown(45)  Then Key$="x"    ;x
          If KeyDown(44)  Then Key$="y"    ;y
          If KeyDown(21)  Then Key$="z"    ;z
          If KeyDown(40)  Then Key$="ä"    ;ä
          If KeyDown(39)  Then Key$="ö"    ;ö
          If KeyDown(26)  Then Key$="ü"    ;ü

        End If

        If KeyDown(12)  Then Key$="ß"      ;ß

        If KeyDown(13)  Then Key$="´"      ;´
        If KeyDown(86)  Then Key$="<"      ;<
        If KeyDown(51)  Then Key$=","      ;,
        If KeyDown(52)  Then Key$="."      ;.
        If KeyDown(53)  Then Key$="-"      ;-
        If KeyDown(43)  Then Key$="#"      ;#
        If KeyDown(41)  Then Key$="^"      ;^
        If KeyDown(27)  Then Key$="+"      ;+
 
       End If 
     End If
    End If
  Else   
   ;--> Verzögerungszeit bis zum Einsetzen des Tastaur-Repeat
   KeyTimer=MilliSecs()+TimeToRepeat
   If Groszbuchstaben=True Then
    Key$=Upper$(Key$)
   End If
 End If
End Function 



Function MausUpdate()
 MausTaste[1]=MouseHit(1)>0
 MausTaste[2]=MouseHit(2)>0
 MausTaste[3]=MouseHit(3)>0
 
 MausX=MouseX()
 MausY=MouseY()


 MausUeberInputBox=0

 If MausTaste[1]=True Then
   For InputBox=Each InputBoxTyp
    InputBoxNr=InputBoxNr+1

    If InputBox\X1=<MausX And InputBox\X1+InputBox\X2=>MausX Then

     If InputBox\Y1=<MausY And InputBox\Y1+InputBox\Y2=>MausY Then
      InputBoxNrNeu=InputBoxNr
      Exit
     End If
    End If
   Next


   If InputBoxNrNeu>0 Then
    FlushKeys
    For InputBox=Each InputBoxTyp
     InputBoxZaehler=InputBoxZaehler+1
     If InputBoxNrNeu=InputBoxZaehler Then
       InputBox\Status=Aktiv
      Else
       If InputBox\Status=Aktiv Then
        InputBox\Status=InAktiv
       End If
     End If
    Next
    FlushKeys
   End If
  Else   

   For InputBox=Each InputBoxTyp
    InputBoxNr=InputBoxNr+1

    If InputBox\X1=<MausX And InputBox\X1+InputBox\X2=>MausX Then
 
     If InputBox\Y1=<MausY And InputBox\Y1+InputBox\Y2=>MausY Then
      MausUeberInputBox=InputBoxNr 
      Exit
     End If
    End If
   Next
 
 End If
   
End Function

Function ColorI(I)
 Color (I And $FF0000)/$10000,(I And $FF00)/$100,I And $FF
End Function


Function DrawInputBox()

 For InputBox=Each InputBoxTyp

  InputBoxNr=InputBoxNr+1
  If InputBox\Status=Aktiv Then
    Color 0,255,255
  ElseIf MausUeberInputBox<>InputBoxNr Then
    Color 0,0,0
   Else
    Color 255,0,0
  End If
  Rect InputBox\X1-1,InputBox\Y1-1,InputBox\X2+2,InputBox\Y2+2,0


  ColorI InputBox\HTextFarbe[0]

  Rect InputBox\X1,InputBox\Y1,InputBox\X2,InputBox\Y2

 
  ColorI InputBox\TextFarbe[0]
  Text InputBox\X1,InputBox\Y1,InputBox\Text

  Select InputBox\Status
   Case Aktiv
    If InputBox\Markiert=True Then
     MarkiertX1=StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\MarkiertX1-Len(InputBox\Text)),1,InputBox\MarkiertX1))
     Color 0,0,255
     Rect InputBox\X1+MarkiertX1,InputBox\Y1,StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\MarkiertX1),InputBox\MarkiertX1+1,InputBox\MarkiertX2)),InputBox\Y2 
     Color 255,255,255
     Text InputBox\X1+MarkiertX1,InputBox\Y1,Mid$(InputBox\Text,InputBox\MarkiertX1+1,InputBox\MarkiertX2)
    End If
 
    If InputBox\Markiert=False Then
     ColorI InputBox\CursorFarbe
     CursorX=InputBox\X1+StringWidth(Mid$(InputBox\Text,1,InputBox\Cursor)+String$(" ",InputBox\Cursor-Len(InputBox\Text)))
 
     If (MilliSecs()/400) Mod 2=True Then
      If InputBox\Ins=True Then
       Rect CursorX,InputBox\Y1,InputBox\CursorBreit,InputBox\Y2   
      Else
       CursorX2=StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\Cursor+1),InputBox\Cursor+1,1))
       Rect CursorX,InputBox\Y1,CursorX2,InputBox\Y2,0
      End If
     End If 
    End If
   Case Inaktiv

   If InputBox\Markiert=False Then
     Color 192,192,192
     CursorX=InputBox\X1+StringWidth(Mid$(InputBox\Text,1,InputBox\Cursor)+String$(" ",InputBox\Cursor-Len(InputBox\Text)))
 
     If (MilliSecs()/400) Mod 2=True Then
      If InputBox\Ins=True Then
       Rect CursorX,InputBox\Y1,InputBox\CursorBreit,InputBox\Y2   
      Else
       CursorX2=StringWidth(Mid$(InputBox\Text+String$(" ",InputBox\Cursor+1),InputBox\Cursor+1,1))
       Rect CursorX,InputBox\Y1,CursorX2,InputBox\Y2,0
      End If
     End If 
    End If

  End Select
 Next
End Function

Function Upper$(S$)
 Slen=Len(S)
 If Slen>0 Then
  For P=1 To Slen
   ASCII=Asc(Mid$(S$,P,1))
   If Ascii>96 And Ascii<123 Then
     Ascii=Ascii-32
    ElseIf Ascii=252 Then ;ü
     Ascii=220     
    ElseIf Ascii=228 Then ;ä
     Ascii=196 
    ElseIf Ascii=246 Then ;ö
     Ascii=214
   End If
   R$=R$+Chr$(ASCII)
  Next
  Return R$
 End If
End Function

Function GetRed(I) 
 Return (I And $FF0000)/$10000
End Function

Function GetGreen(I)   
 Return (I And $FF00)/$100
End Function

Function GetBlue(I)
 Return I And $FF
End Function

Function Farbe(r,g,B)
 Return r*$10000 + g*$100 + b
End Function




Tab
Pos1
Ende
Einfg
Entf
Enter
Pfeil nach links
Pfeil nach rechts

Strg+A
Strg+V
Strg+C
Strg+X
Strg+Einfg
Strg+Pfeil nach links
Strg+Pfeil nach rechts

Shift+recht Pfeil nachs
Shift+Pfeil nach links
Shift+Pos1
Shift+Ende
Shift+Entf

Shift+Strg+Pfeil nach links
Shift+Strg+Pfeil nach rechts
Shiftd+Strg+G

Code:


Type InputBoxTyp
 Field X1       
 Field X2
 Field Y1
 Field Y2

 Field Tab          ;Tabnummer
 Field Status       ;Aktiv oder inaktiv
 Field Cursor       ;position des Cursors
 Field CursorBreit

 Field MarkiertX1 ;Markiert ab
 Field MarkiertX2 ;Anzahl zeichen die Markiert sind
 Field Markiert   ;True oder FALSE
 Field Text$
 Field MaxLang

 Field CursorFarbe   ;CursorFarbe=Farbe(r,g,B) 

 Field TextFarbe[1]  ;TextFarbe[0]=Farbe(r,g,B) 
                     ;Text ist nicht  Markiert

                     ;TextFarbe[1]=Farbe(r,g,B) 
                     ;Text ist  Markiert


 Field HTextFarbe[1] ;HTextFarbe[0]=Farbe(r,g,B)
                     ;Text ist nicht  Markiert

                     ;HTextFarbe[1]=Farbe(r,g,B)
                     ;Text ist  Markiert

 Field Ins           ;True oder FALSE
End Type

Klip

BeitragDo, Okt 27, 2005 23:50
Antworten mit Zitat
Benutzer-Profile anzeigen
Zitat:
If KeyDown(30) Then Key$="A" ;A
If KeyDown(48) Then Key$="B" ;B
If KeyDown(46) Then Key$="C" ;C
If KeyDown(32) Then Key$="D" ;D
If KeyDown(18) Then Key$="E" ;E
If KeyDown(33) Then Key$="F" ;F
If KeyDown(34) Then Key$="G" ;G
If KeyDown(35) Then Key$="H" ;H


Ähm, hast du schon einmal über GetKey() nachgedacht? Würde deinen Code um etwa 252 Zeilen kürzen...

Triton

BeitragFr, Okt 28, 2005 20:46
Antworten mit Zitat
Benutzer-Profile anzeigen
@Florian: Bitte bitte lass das! Deine Codes sind nicht nur viel zu lang, es ist auch unpassend diesen Roman hier direkt zu posten. Ein link tuts auch.
Coding: silizium-net.de | Portfolio: Triton.ch.vu
 

Paranoide

BeitragSa, Okt 29, 2005 1:08
Antworten mit Zitat
Benutzer-Profile anzeigen
Wo wir da schon mal sind, eine Sache, die ich immer schon mal wissen wollte (auch wenn ich's nie brauchen werde, weil ich ja fast nur noch mit Text anstatt mit Print arbeite):

Wenn man jetzt ein paar Mal den Befehl Print benutzt, dann geht der Cursor ja eine Zeile tiefer, bis der ja irgendwann unten angekommen ist. "Write" würde ja nie eine Zeile runter gehen, aber wenn man dann nun irgendwann ganz unten ist, kann man der Cursor wieder nach oben packen, auch ohne Locate zu benutzen?

Michel

Triton

BeitragSa, Okt 29, 2005 2:06
Antworten mit Zitat
Benutzer-Profile anzeigen
Mit Cls vermutlich.
Coding: silizium-net.de | Portfolio: Triton.ch.vu
 

Paranoide

BeitragSa, Okt 29, 2005 14:45
Antworten mit Zitat
Benutzer-Profile anzeigen
Nee, dachte ich auch immer, aber mit Cls geht's auch net....dann wohl doch nur mit LOCATE.

Michel

Neue Antwort erstellen


Übersicht BlitzBasic Allgemein

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group