Input platzieren

Übersicht BlitzBasic Beginners-Corner

Neue Antwort erstellen

Puccini

Betreff: Input platzieren

BeitragFr, Mai 11, 2007 17:18
Antworten mit Zitat
Benutzer-Profile anzeigen
hi!

Wink ich hab da ein problem das ich net selber gelöst bekomm!

Ich will das der Input an einer bestimmten stelle steht und net immer links am rand!

Hab es so gedacht!
Code: [AUSKLAPPEN]
Text x,y,Input()


klappt aber net :< wie muss ich das dann realisieren??
-=Achtung=-
Suche Hobby-Modelliere der hin und wieder bock hat ein kleines Objekt zu erstellen. Bei Interesse PM
www.ragesoft.de
Passwortmanager: http://ragesoft.de/index.php?o...;Itemid=39

BladeRunner

Moderator

BeitragFr, Mai 11, 2007 17:22
Antworten mit Zitat
Benutzer-Profile anzeigen
ql:locate wäre was Du suchst.
Ich rate allerdings prinzipiell von Input ab, da es das gesamte Programm ausbremst und nur im Frontbuffer arbeitet. Im Archiv sollten Inputroutinen zu finden sein welche wesentlich besser sind.
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92

Silver_Knee

BeitragFr, Mai 11, 2007 17:25
Antworten mit Zitat
Benutzer-Profile anzeigen
1. locate Arrow Bltizbase
2. warum schreibst du nicht eines selber: Chr(), GetKey(),
txt=Left(txt,len(txt)-1)=Backspace usw usf

EDIT ajajaj... whe man überlegt 2mal was man schreibt...

BladeRunner

Moderator

BeitragFr, Mai 11, 2007 17:28
Antworten mit Zitat
Benutzer-Profile anzeigen
Wenn Du eh doppelt überlegst nimm Dir bitte auch noch die Zeit solange nachzudenken bis Du es verständlich schreibst.
Deine Posts fallen immer wieder durch einen massiven Mangel an Interpunktion und Grammatik auf.
Zu Diensten, Bürger.
Intel T2300, 2.5GB DDR 533, Mobility Radeon X1600 Win XP Home SP3
Intel T8400, 4GB DDR3, Nvidia GF9700M GTS Win 7/64
B3D BMax MaxGUI

Stolzer Gewinner des BAC#48, #52 & #92

Abrexxes

BeitragFr, Mai 11, 2007 17:28
Antworten mit Zitat
Benutzer-Profile anzeigen
Code: [AUSKLAPPEN]

Function GetInput$(x,y,sPrompt$,sFilter$,sDefault$,iMaxLength)
   ; x = x location of the prompt, if any, or text input
   ; y = y location ...
   ; sPrompt$ is the prompt, such as "Please enter your name:"
   ; sFilter$ is very useful. It ONLY allows the user to enter certain characters. For example, "ync" would only allow "y","n" or "c"
   ;          There are also a few special 'codes':
   ;            "/all" or "" means allow anything to be entered
   ;             "/123" allows only 0 through 9 to be entered
   ;            "/abc" allows only letters of the alphabet to be entered
   
   FlushKeys
   iFlashInterval = 300      ; The blinking cursor speed
   sTotal$ = sDefault$
   iNumDigits = Len(sDefault$)
   
   If Lower$(sFilter$) = "/123" Then sFilter$ = "0123456789"               ; All the numbers
   If Lower$(sFilter$) = "/abc" Then sFilter$ = "abcdefghijklmnopqrstuvwxyz"   ; All the letters
   
   iTotalWidth = StringWidth(sPrompt$) + (iMaxLength * FontWidth())
   iTotalHeight = FontHeight()
   
   hTextBuffer = CreateImage(iTotalWidth,iTotalHeight)   ; Where the text will be drawn before blitting to the backbuffer()
   hCleanCopy = CreateImage(iTotalWidth,iTotalHeight)   ; Will hold a clean copy of the backbuffer (not the whole thing)
   MaskImage hTextBuffer,255,0,255                  ; Make the text background transparent so we can show text with BG showing
   SetBuffer ImageBuffer(hTextBuffer)               ; We're going to draw to the text buffer
   ClsColor 255,0,255                           ; Temporarily make the cls color the transparent color (magenta)
   Cls                                       ; Now clear to magenta
   ; Foreground (text) will be drawn in the current color
   
   CopyRect x,y,iTotalWidth,iTotalHeight,0,0,BackBuffer(),ImageBuffer(hCleanCopy)   ; Save a clean copy of the back buffer where the
                                                               ;    text is going to be

   SetBuffer BackBuffer()
   Repeat
      ; Blinking cursor code *******************************************************************************************************
      iCurrentTime = MilliSecs()
      If bFlash = True Then
         If (iCurrentTime - iOldFlashTime) >= iFlashInterval Then
            bFlash = False
            iOldFlashTime = MilliSecs()
         EndIf
      Else
         If (iCurrentTime - iOldFlashTime) >= iFlashInterval Then
            bFlash = True
            iOldFlashTime = MilliSecs()
         EndIf
      EndIf
      
      ; Input starts here **********************************************************************************************************
      iKeyPressed = GetKey()
      If iKeyPressed = 13 Then
         sKeyPressed$ = ""
      Else
         sKeyPressed$ = Chr$(iKeyPressed)
      EndIf
      
      ; If the key passes, add it to the total *************************************************************************************
      If iKeyPressed Then
         If (sFilter$ = "/all") Or (sFilter$ = "") Or (Instr(sFilter$,sKeyPressed$) > 0) Then ; "all" does not filter any keys out
            If Len(sTotal$) < iMaxLength Then
               sTotal$ = sTotal$ + sKeyPressed$                        ; Add it to the total string if it passes
               iNumDigits = iNumDigits + 1
            EndIf
         EndIf
      EndIf
      
      ; If backspace was pressed, delete the last character from the total and update the number of digits *************************
      If KeyDown(14) And iNumDigits > 0 Then
         sTotal$ = Left$(sTotal$,iNumDigits - 1)
         iNumDigits = iNumDigits - 1
         Delay 50
      EndIf
      
      ; Draw the clean background and then the text on the backbuffer() ************************************************************
      DrawBlock hCleanCopy,x,y

      ; Draw the cursor if enough time has passed (change iFlashInterval for different speeds) *************************************
      If Len(sTotal$) = iMaxLength Then
         rx = StringWidth(sPrompt$ + sTotal$) - StringWidth(Right$(sTotal$,1))
         rw = StringWidth(Right$(sTotal$,1))
      Else
         rx = StringWidth(sPrompt$) + (Len(sTotal$) * FontWidth())
         rw = FontWidth()
      EndIf
 
      If bFlash = True Then
         Text x,y,sPrompt$ + sTotal$
         Rect x + rx,y,rw,FontHeight(),True
      Else
         Text x,y,sPrompt$ + sTotal$
      EndIf

      Flip
   Until iKeyPressed = 13 ; This is the 'return/enter' key
   
   ClsColor 0,0,0   ; Reset back to black
   Return sTotal$
End Function

hab ich mal auf bcom gefunden. Ein paar änderungen je nach Wunsch und alles ist gut. Smile

Puccini

BeitragFr, Mai 11, 2007 17:28
Antworten mit Zitat
Benutzer-Profile anzeigen
das mit locate war mir bekannt, es steht aber immer da man solle das nicht verwenden , da es demnächst entfernt wird ^^

eine Inputroutine selber schreiben :< was anderes wird mich nich überbleiben :-/ mist
-=Achtung=-
Suche Hobby-Modelliere der hin und wieder bock hat ein kleines Objekt zu erstellen. Bei Interesse PM
www.ragesoft.de
Passwortmanager: http://ragesoft.de/index.php?o...;Itemid=39

Smily

BeitragFr, Mai 11, 2007 19:25
Antworten mit Zitat
Benutzer-Profile anzeigen
locate wird demnächst entfernt?
Das wusst ich noch gar net.
Wenn M.S. aber schon so nett ist soll er bitte auch gleich Print und Input rausnehmen Laughing
Lesestoff:
gegen Softwarepatente | Netzzensur | brain.exe | Unabhängigkeitserklärung des Internets

"Wir müssen die Rechte der Andersdenkenden selbst dann beachten, wenn sie Idioten oder schädlich sind. Wir müssen aufpassen. Wachsamkeit ist der Preis der Freiheit --- Keine Zensur!"
stummi.org

D2006

Administrator

BeitragFr, Mai 11, 2007 20:12
Antworten mit Zitat
Benutzer-Profile anzeigen
Steht seit Jahren in der Onlinehilfe. Wird (leider) bestimmt nicht mehr entfernt.
Ach btw. passt das hier besser in die Beginners Corner.

~VERSCHOBEN~
Dieser Thread passte nicht in das Forum, in dem er ursprünglich gepostet wurde.
Intel Core i5 2500 | 16 GB DDR3 RAM dualchannel | ATI Radeon HD6870 (1024 MB RAM) | Windows 7 Home Premium
Intel Core 2 Duo 2.4 GHz | 2 GB DDR3 RAM dualchannel | Nvidia GeForce 9400M (256 MB shared RAM) | Mac OS X Snow Leopard
Intel Pentium Dual-Core 2.4 GHz | 3 GB DDR2 RAM dualchannel | ATI Radeon HD3850 (1024 MB RAM) | Windows 7 Home Premium
Chaos Interactive :: GoBang :: BB-Poker :: ChaosBreaker :: Hexagon :: ChaosRacer 2

Neue Antwort erstellen


Übersicht BlitzBasic Beginners-Corner

Gehe zu:

Powered by phpBB © 2001 - 2006, phpBB Group