Input platzieren
Übersicht

![]() |
PucciniBetreff: Input platzieren |
![]() Antworten mit Zitat ![]() |
---|---|---|
hi!
![]() 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 |
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
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 |
![]() Antworten mit Zitat ![]() |
---|---|---|
1. locate ![]() 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... |
||
![]() |
BladeRunnerModerator |
![]() Antworten mit Zitat ![]() |
---|---|---|
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 |
![]() Antworten mit Zitat ![]() |
---|---|---|
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. ![]() |
||
![]() |
Puccini |
![]() Antworten mit Zitat ![]() |
---|---|---|
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 |
![]() Antworten mit Zitat ![]() |
---|---|---|
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 ![]() |
||
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 |
![]() |
D2006Administrator |
![]() Antworten mit Zitat ![]() |
---|---|---|
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 |
Übersicht


Powered by phpBB © 2001 - 2006, phpBB Group