January 20, 2021, 01:19:18 PM
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Home
Forum
Help
Search
Gallery
Login
Register
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] GadGetKey_TextArea by ShadowTurtle [ 1+ years ago ]
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: [bb] GadGetKey_TextArea by ShadowTurtle [ 1+ years ago ] (Read 567 times)
BlitzBot
Jr. Member
Posts: 1
[bb] GadGetKey_TextArea by ShadowTurtle [ 1+ years ago ]
«
on:
June 29, 2017, 12:28:40 AM »
Title :
GadGetKey_TextArea
Author :
ShadowTurtle
Posted :
1+ years ago
Description :
Hi.
Here is a small sample:
...
While Programm
...
A$ = GadGetKey_TextArea(MyTextArea)
If A$ = "j" Then RuntimeError "You pressed 'j' in TextArea"
Wend
Code :
Code: BlitzBasic
wnd = CreateWindow
(
"GadGet Key - Test"
,
10
,
10
,
400
,
400
,
0
,
1
)
butn1 = CreateButton
(
"Exit."
,
2
,
2
,
100
,
30
, wnd
)
textlabel = CreateLabel
(
"Please press a key in textarea."
,
120
,
2
,
200
,
20
, wnd
)
textarea = CreateTextArea
(
2
,
40
,
388
,
300
, wnd
)
Programm =
1
While
Programm
MyEvent = WaitEvent
(
)
If
EventSource
(
)
= butn1
Then
Programm =
0
If
EventSource
(
)
= textarea
Then
I$ = GadGetKey_TextArea$
(
textarea
)
SetGadgetText textlabel,
"You have lost pressed: "
+ I$
End If
Wend
Type
ScanGadGetKey
Field
GadGetHandle
Field
LostGadGetText$
Field
NewGadGetText$
Field
GadGetType
End Type
Function
GadGetKey_TextArea$
(
objhandle
)
Local
SGGK.ScanGadGetKey
SGGK =
Null
For
ScanGadGetKey.ScanGadGetKey =
Each
ScanGadGetKey
If
ScanGadGetKeyGadGetHandle = objhandle
Then
SGGK = ScanGadGetKey
Next
If
SGGK =
Null
Then
SGGK.ScanGadGetKey =
New
ScanGadGetKey
SGGKGadGetHandle = objhandle
SGGKLostGadGetText$ = TextAreaText$
(
objhandle
)
SGGKGadGetType =
0
Return
GadGetKey_TextArea$
(
objhandle
)
Else
SGGKLostGadGetText$ = SGGKNewGadGetText$
SGGKNewGadGetText$ = TextAreaText$
(
SGGKGadGetHandle
)
For
GGKT =
1
To
Len
(
SGGKNewGadGetText$
)
If
Not
(
Mid
$
(
SGGKNewGadGetText$, GGKT,
1
)
=
Mid
$
(
SGGKLostGadGetText$, GGKT,
1
)
)
Then
Return
Mid
$
(
SGGKNewGadGetText$, GGKT,
1
)
End If
Next
End If
End Function
Comments :
danielos(Posted 1+ years ago)
could you do this also for mouseclicks and keys like [CTRL] and [Enter] ?
ShadowTurtle(Posted 1+ years ago)
This isnt possible without winapi, i think. The solution on top uses only blitzplus commands. No winapi-userlib is required.
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
SyntaxBomb - Indie Coders
»
Languages & Coding
»
Blitz Code Archives
»
BlitzPlus Gui
»
[bb] GadGetKey_TextArea by ShadowTurtle [ 1+ years ago ]
SimplePortal 2.3.6 © 2008-2014, SimplePortal