[ALLY] Problems with field & mouse clicks
From: peoyli::algonet::se at: 4-Nov-2000 0:41
No need to duplicate the text in the Header/Comment below...
Any idea on how to solve this one, or is the only solution to create
a new field face ?
What I need is a text field that submits only on pressign the return
key, and that always is active (as long as no other field in the same
window is active).
/PeO
REBOL [
Title: "ViewTest"
Version: 0.0.3
Author: "PeO"
File: %viewtest.r
Email: [peoyli--algonet--se]
Purpose: {Just to test something}
Comment: {
Current problem: Clicking anywhere in the window acts like pressing
the enter key in the input-field. A commented check to see if the
string in the field is empty solves this problem - partial. I do not
want any string in the input field to be submitted unless the enter
key is pressed.
This problem occurs always after submitting the first line, and also
as early as just after restarting the program if the input field was
not empty when quitting.
Without defining the input field with
input-field: field #"^M" iboxsize [...
the field is deselected every time after enter is pressed. The focus
function does not re-enable the field as I hoped it should do.
Other problems: Sometimes, the title text in the window, above the
text output box disappears when either scrolling in the box or clicking
anywhere inside the window.
The slider's knob is not correctly sized (I want it to be proportional)
The problems exists at least on the Amiga and Solaris versions of View
0.10.38
}
]
appname: "ViewTest 0.0.3"
code: read system/script/header/file
fsize: 11
tboxlines: 20
tboxwidth: 500
tboxsize: to-pair rejoin [tboxwidth "x" tboxlines * fsize]
iboxsize: to-pair rejoin [tboxsize/x "x" fsize + 9]
fontspec: [
color: 0.255.0
shadow: none
name:"helvetica"
size: fsize
]
main: layout [
backdrop 70.0.100
origin 10x15
at 10x10 title appname
at 10x30 text "Type 'source' to fill the box with the source for this program"
across space 2
at 10x50
text-face: text tboxsize with [
para/origin/y: 0
text: rejoin ["Welcome to " appname]
color: 0.0.0 font: fontspec
]
text-scroller: slider with [
size/y: tboxsize/y
size/x: 14
] [
tsize: size-text text-face
if tsize/y > text-face/size/y
[
newy: text-face/size/y - tsize/y * text-scroller/data
text-face/para/origin/y: newy
]
show text-face
]
below ;space 1
input-field: field #"^M" iboxsize [
; if not empty? input-field/text [
print join "|" [input-field/text "|"]
more-text: input-field/text
if input-field/text = "source" [
more-text: code
]
text-face/text: insert tail text-face/text join #"^/" more-text
input-field/text: copy ""
tsize: size-text text-face
either tsize/y > text-face/size/y [
text-face/para/origin/y: text-face/size/y - tsize/y
text-scroller/data: 1
] [
text-scroller/data: divide tsize/y text-face/size/y
]
show text-scroller
show text-face
focus input-field
; ]
]
]
view/title/offset main appname 500x500