Main Menu

A problem

Started by basil99, July 04, 2005, 12:04:52 AM

Previous topic - Next topic

basil99

Hi !

I meet a funny problem. Better describe it with code:

------------------------------------------- Cut Here ------------------------

; Can't see default font, like big letters
LoadFont "Ariel",2,18,1
SetFont 2

; Some vars
Constant UPk = 200
Constant DOWNk = 208
cursor = 1
Maxcursor = 100
Text$ = "start"

; Load DLL and define smth
Global PBDialogs_DLL
PBDialogs_DLL = GetFreeDll()
LoadDll "pbdialogs.dll",PBDialogs_DLL

Type TInputQuery
   Caption As String
   Prompt As String
   TextValue As String
EndType

Dim InputQ As TInputQuery

InputQ.Caption = "Caption"
InputQ.Prompt = "Prompt"
InputQ.TextValue = Text$


; Well, actual job. Up and Urror arrow changes "cursor" variable,
; left mouse click invokes Input Box for "text$" editing.
; Everything is simple

MainLoop:

Cls RGB( 0,0,0 )
Ink RGB( 255,255,0)
SetCursor 1,1
Print cursor
Print Text$
Sync

a = ScanCode()

;Some keyboard stuff
Select a
Case UPk
   
   cursor = cursor - 1
   If cursor < 1 Then cursor = 1
   
   
Case DOWNk
   
   cursor  = cursor + 1
   If cursor > 10 Then cursor = Maxcursor

      
EndSelect


; Edit Text$ variable with PB dialogs DLL
m = MouseButton()
If m = 1

   result = CallDll(PBDialogs_DLL,"InputQuery", InputQ.TInputQuery)
   if result = 1 then Text$ = InputQ.TextValue

EndIf

Goto Mainloop

------------------------------------------- Cut Here ------------------------



Well, when i run programm and click left button first time, I'm really got input window and can edit text.
But !

I can't get rid of it ! It popups again and again !
I try to close it with Alt-F4, witk "cancel" buttons, with mouse and using only keyboard etc. This happens on 2 different machines at home and office - one run under Win98, another under XP.

Yes, I purchased Pbasic and run full commercial version

Any ideas ?
Free Games Site - http://vespacrabro.com

kevin

Yes that's an ODD problem.  For some reason once the Input box is called, the mousebutton() function always returns a one.   I dunno if that's a PB drama or problem with the dialog dll.

kevin

#2
ok, i added a FlushMouse command to PB1.08c. This command clears the mouses input events.  So the following version works as you'd expect.


PlayBASIC Code: [Select]
; Edit Text$ variable with PB dialogs DLL
m = MouseButton()
If m = 1

result = CallDll(PBDialogs_DLL,"InputQuery", InputQ.TInputQuery)
if result = 1 then Text$ = InputQ.TextValue
FlushMouse
EndIf






basil99

#3
Cool !

I suspected, its nor a DLL problem, but a kind of input, cause I play with many dlls, like messagebox, opensave dialogs etc.  I think you can add smth like "FlushKeyboard"  too ;-)

But how I can download this update ? I bought Pbasil at thegamescreator.com
If you need a proof, I can PM you my regcode etc





Quoteok, i added a FlushMouse command to PB1.08c. This command clears the mouses input events.  So the following version works as you'd expect.


; Edit Text$ variable with PB dialogs DLL
m = MouseButton()
If m = 1

result = CallDll(PBDialogs_DLL,"InputQuery", InputQ.TInputQuery)
if result = 1 then Text$ = InputQ.TextValue
  FlushMouse
EndIf


Free Games Site - http://vespacrabro.com