I'll try to explain:
I have a text field in my app. When the app is run and when I tap on the text field, instead of the cursor appearing at the top of the field, as it would normally , it instead always appears in the middle of the text field.
Show/Hide Keyboard
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Show/Hide Keyboard
Yes, I understnd this. But when I run this code:
I get a text field, and when I tap it - cursor appears in its left corner, as it should.
Code: Select all
FIELD 0 AT 100,100
Re: Show/Hide Keyboard
Here is my code:
'BobCalc (c)2015 Bob Tedesco Jr
GOSUB initialize
GOSUB displaySetup
main:
for i = 0 to buttons-1
if button_pressed(button$(i))=1 then
buttonISpressed=1
if i < 10 then
if stack$(argument)<>"0" then
stack$(argument)=stack$(argument) & button$(i)
else
stack$(argument)=button$(i)
endif
Result$=stack$(argument)
break
end if
end if
next i
if buttonISpressed then
buttonISpressed=0
DRAW TEXT Result$ AT margin,margin
end if
goto main
initialize:
sh=SCREEN_HEIGHT()
sw=SCREEN_WIDTH()
middle=sh/2
margin=15
argument=1
arg1=0
arg2=0
op$=""
note$=" "
Result$="0"
buttonISpressed=0
buttons=20
option base(0)
dim stack$(3)
dim decimal$(3)
dim button$(buttons)
for i = 0 to 9
button$(i)=i
next i
stack$(1)="0"
stack$(2)="0"
return
displaySetup:
GRAPHICS
GRAPHICS CLEAR .8,.8,.8
SET BUTTONS CUSTOM
SET BUTTONS FONT NAME "TrebuchetMS"
SET BUTTONS FONT SIZE 24
FILL COLOR .85,.85,.85
DRAW COLOR .5,.5,.5
nw=sw-(margin*2) ! nh=middle-margin
c2=sw/4 ! c3=c2*2 ! c4=c2*3
r1=50 ! r2=r1*2 ! r3=r1*3 ! r4=r1*4
bw=(sw/4)-10 ! bh=50
BUTTON "0" TEXT "0" AT c2+margin,r4 SIZE bw,bh
BUTTON "1" TEXT "1" AT margin,r1 SIZE bw,bh
BUTTON "2" TEXT "2" AT c2+margin,r1 SIZE bw,bh
BUTTON "3" TEXT "3" AT c3+margin,r1 SIZE bw,bh
BUTTON "4" TEXT "4" AT margin,r2 SIZE bw,bh
BUTTON "5" TEXT "5" AT c2+margin,r2 SIZE bw,bh
BUTTON "6" TEXT "6" AT c3+margin,r2 SIZE bw,bh
BUTTON "7" TEXT "7" AT margin,r3 SIZE bw,bh
BUTTON "8" TEXT "8" AT c2+margin,r3 SIZE bw,bh
BUTTON "9" TEXT "9" AT c3+margin,r3 SIZE bw,bh
FIELD note$ AT margin,middle SIZE nw,nh
return
resetAll:
argument=1
op$=""
stack$(1)="0"
stack$(2)="0"
decimal$(1)=""
decimal$(2)=""
return
'BobCalc (c)2015 Bob Tedesco Jr
GOSUB initialize
GOSUB displaySetup
main:
for i = 0 to buttons-1
if button_pressed(button$(i))=1 then
buttonISpressed=1
if i < 10 then
if stack$(argument)<>"0" then
stack$(argument)=stack$(argument) & button$(i)
else
stack$(argument)=button$(i)
endif
Result$=stack$(argument)
break
end if
end if
next i
if buttonISpressed then
buttonISpressed=0
DRAW TEXT Result$ AT margin,margin
end if
goto main
initialize:
sh=SCREEN_HEIGHT()
sw=SCREEN_WIDTH()
middle=sh/2
margin=15
argument=1
arg1=0
arg2=0
op$=""
note$=" "
Result$="0"
buttonISpressed=0
buttons=20
option base(0)
dim stack$(3)
dim decimal$(3)
dim button$(buttons)
for i = 0 to 9
button$(i)=i
next i
stack$(1)="0"
stack$(2)="0"
return
displaySetup:
GRAPHICS
GRAPHICS CLEAR .8,.8,.8
SET BUTTONS CUSTOM
SET BUTTONS FONT NAME "TrebuchetMS"
SET BUTTONS FONT SIZE 24
FILL COLOR .85,.85,.85
DRAW COLOR .5,.5,.5
nw=sw-(margin*2) ! nh=middle-margin
c2=sw/4 ! c3=c2*2 ! c4=c2*3
r1=50 ! r2=r1*2 ! r3=r1*3 ! r4=r1*4
bw=(sw/4)-10 ! bh=50
BUTTON "0" TEXT "0" AT c2+margin,r4 SIZE bw,bh
BUTTON "1" TEXT "1" AT margin,r1 SIZE bw,bh
BUTTON "2" TEXT "2" AT c2+margin,r1 SIZE bw,bh
BUTTON "3" TEXT "3" AT c3+margin,r1 SIZE bw,bh
BUTTON "4" TEXT "4" AT margin,r2 SIZE bw,bh
BUTTON "5" TEXT "5" AT c2+margin,r2 SIZE bw,bh
BUTTON "6" TEXT "6" AT c3+margin,r2 SIZE bw,bh
BUTTON "7" TEXT "7" AT margin,r3 SIZE bw,bh
BUTTON "8" TEXT "8" AT c2+margin,r3 SIZE bw,bh
BUTTON "9" TEXT "9" AT c3+margin,r3 SIZE bw,bh
FIELD note$ AT margin,middle SIZE nw,nh
return
resetAll:
argument=1
op$=""
stack$(1)="0"
stack$(2)="0"
decimal$(1)=""
decimal$(2)=""
return
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Show/Hide Keyboard
So what I should do to get the probem?
If I hit the text field, cursor is in leftmost position.
If I hit the text field, cursor is in leftmost position.
Re: Show/Hide Keyboard
It does appear at the left, but is the cursor vertically centered in the text field, or at the top.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Show/Hide Keyboard
This is a single-line text field, so cursor is always centered vertically. Actually height of your field is too big now.
Multi-line text field will be available in version 4.8. Text field font properties also will be available in version 4.8.
Multi-line text field will be available in version 4.8. Text field font properties also will be available in version 4.8.
Re: Show/Hide Keyboard
Ok good. When will 4.8 be available?
Do you anticipate including custom button image or shape features?
Do you anticipate including custom button image or shape features?
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Show/Hide Keyboard
Version 4.8 will be available soon.
You can use sprites for buttons with custom shapes.
You can use sprites for buttons with custom shapes.
- Mr. Kibernetik
- Site Admin
- Posts: 4786
- Joined: Mon Nov 19, 2012 10:16 pm
- My devices: iPhone, iPad, MacBook
- Location: Russia
- Flag:
Re: Show/Hide Keyboard
This feature will be implemented in version 5.1.greycheek wrote:I want to be able to move the screen up using the page commands, but in order to do that there needs to be some way to know when the keyboard is active.