<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 7/14/23 5:52 PM, Hilaire Fernandes
wrote:<br>
</div>
<blockquote type="cite"
cite="mid:1e423e43-da6d-dbc3-06c1-e35ff53404c7@free.fr">Le
14/07/2023 à 11:53, Gerald Klix a écrit :
<br>
<blockquote type="cite">I presume any one who does serious
application programming with Cuis
<br>
will run into that problem, me included.
<br>
</blockquote>
<br>
That's right.
<br>
<br>
<br>
<blockquote type="cite">
<br>
(I have to confess, that I solved the input problem for times
and dates -- I hope you remeber, that we talked about that one
--
<br>
for Haver, without consulting the community)
<br>
</blockquote>
<br>
Yes, I remember. Did you write dedicated widgets for that?
Screenshot?
<br>
</blockquote>
Currently it looks like this (pretty boring):<br>
<img src="cid:part1.A8FE7F4A.1D4081C5@klix.ch" alt=""><br>
<br>
There is no text cursor, you just can type numbers,<br>
use the up down arrows or the mouse wheel<br>
to increment or decrement the numbers,<br>
either by one or 10 (6 for hours part of a time input morph)<br>
together with the shift key. The del key zeros the input field,<br>
backspace deletes the last digit. Code probably tells more<br>
than English prose:<br>
<br>
<tt>keyStroke: aKeyboardEvent<br>
"Handle a keystroke event."<br>
<br>
| uppercaseCharacter |<br>
self focusKeyboardFor: aKeyboardEvent :: ifTrue: [ ^ self ].<br>
"D: Transcript newLine; show: 'kS: '; show: aKeyboardEvent
keyCharacter."<br>
(uppercaseCharacter := aKeyboardEvent keyCharacter
asUppercase) digitValue<br>
between: 0 and: self base - 1 ::<br>
ifTrue: [ self contents: (contents copyWith:
uppercaseCharacter) ]<br>
ifFalse: [<br>
aKeyboardEvent keyCharacter caseOf: {<br>
[ $- ] -> [ self integer: self integer
negated ].<br>
[ $+ ] -> [ self integer: self integer abs
] }<br>
otherwise: [ | hand |<br>
aKeyboardEvent isDelete ifTrue: [<br>
^ self integer: self initialValue ].<br>
aKeyboardEvent isBackspace and: [ contents
size > 1 ] :: ifTrue: [<br>
^ self contents: (contents copyFrom: 1 to:
contents size - 1) ].<br>
aKeyboardEvent isArrowUp ifTrue: [<br>
^ self increment: aKeyboardEvent
shiftPressed ].<br>
aKeyboardEvent isArrowDown ifTrue: [<br>
^ self decrement: aKeyboardEvent
shiftPressed ].<br>
hand := aKeyboardEvent hand.<br>
aKeyboardEvent isArrowLeft ifTrue: [<br>
^ hand keyboardFocusPreviousWithinWindow
].<br>
aKeyboardEvent isArrowRight ifTrue: [<br>
^ hand keyboardFocusNextWithinWindow ].<br>
aKeyboardEvent isTab ifTrue: [<br>
^ aKeyboardEvent shiftPressed<br>
ifTrue: [ hand
keyboardFocusPreviousWithinWindow ]<br>
ifFalse: [ hand
keyboardFocusNextWithinWindow ] ].<br>
self flash ] ]<br>
</tt>Alas this (probably) depends on Haver's changed keyboard focus
handling.<br>
<br>
The class is a subclass of label morph:<br>
<tt>LabelMorph subclass: #SimpleIntegerInputMorph</tt><tt><br>
</tt><tt> instanceVariableNames: 'numberOfDigits bigDelta
littleDelta blinkOn base checkBlock valueBlock'</tt><tt><br>
</tt><tt> classVariableNames: ''</tt><tt><br>
</tt><tt> poolDictionaries: ''</tt><tt><br>
</tt><tt> category: 'ValueEditors-SimpleMorphs'</tt><tt><br>
</tt><tt> inModule: #ValueEditors</tt><tt><br>
</tt><br>
The remaining stuff uses this <tt>SimpleIntegerInputMorph</tt>
class to build<br>
an integer input morph with a model, which is then combined <br>
to create a time and a date input morph classes, which in turn are
combined<br>
to create a date and time input morphs.<tt><br>
</tt>All of this uses subclasses of Haver's <tt>AbstractSystemMorph
</tt>and<tt><br>
AbstractSystemMorphModel </tt>classes.<tt><br>
<br>
<br>
</tt><tt>
</tt>
<blockquote type="cite"
cite="mid:1e423e43-da6d-dbc3-06c1-e35ff53404c7@free.fr">
<br>
<blockquote type="cite">
<br>
What do you have in mind? Something like the attached screen
shot?
<br>
</blockquote>
<br>
Indeed<br>
</blockquote>
<blockquote type="cite"
cite="mid:1e423e43-da6d-dbc3-06c1-e35ff53404c7@free.fr">
<br>
<br>
<blockquote type="cite">
<br>
BTW: Are there any primitives (in the VM) that answer
<br>
the user's home directory, the available drives and other
<br>
filesystem related information? </blockquote>
<br>
For the home directory, I did not find it, I passed the info from
the bash start script
<br>
</blockquote>
One could use the OSProcess-package, with its dependencies, to<br>
to retrieve environment variables like <tt>HOME</tt>.<br>
<blockquote type="cite"
cite="mid:1e423e43-da6d-dbc3-06c1-e35ff53404c7@free.fr">
<br>
Hilaire
<br>
<br>
</blockquote>
<br>
<br>
HTH,<br>
<br>
Gerald<br>
</body>
</html>