Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
clean-and-itasks
clean-libraries
Commits
4621ec02
Commit
4621ec02
authored
Nov 22, 2001
by
Peter Achten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(PA) setEditControlSelection function added in StdControl.
parent
6e238a91
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
87 additions
and
6 deletions
+87
-6
ObjectIO/ObjectIO Examples/scrabble/scrabble.icl
ObjectIO/ObjectIO Examples/scrabble/scrabble.icl
+8
-3
ObjectIO/ObjectIO/OS Windows/oswindow.dcl
ObjectIO/ObjectIO/OS Windows/oswindow.dcl
+3
-0
ObjectIO/ObjectIO/OS Windows/oswindow.icl
ObjectIO/ObjectIO/OS Windows/oswindow.icl
+4
-0
ObjectIO/ObjectIO/StdControl.dcl
ObjectIO/ObjectIO/StdControl.dcl
+11
-1
ObjectIO/ObjectIO/StdControl.icl
ObjectIO/ObjectIO/StdControl.icl
+20
-0
ObjectIO/ObjectIO/StdWindow.icl
ObjectIO/ObjectIO/StdWindow.icl
+1
-1
ObjectIO/ObjectIO/controlinternal.dcl
ObjectIO/ObjectIO/controlinternal.dcl
+2
-1
ObjectIO/ObjectIO/controlinternal.icl
ObjectIO/ObjectIO/controlinternal.icl
+38
-0
No files found.
ObjectIO/ObjectIO Examples/scrabble/scrabble.icl
View file @
4621ec02
...
...
@@ -266,9 +266,14 @@ where
// The user request the placement of a word:
placeword
::
(
PSt
*
State
)
->
PSt
*
State
placeword
pst
#
(
maybeScrabble
,
pst
)
=
accPIO
(
getWindow
scrabbleId
)
pst
|
isNothing
maybeScrabble
=
abort
"placeword could not retrieve WState from Scrabble window."
|
otherwise
=
placeword`
(
fromJust
maybeScrabble
)
pst
#
(
maybeScrabble
,
pst
)
=
accPIO
(
getWindow
scrabbleId
)
pst
|
isNothing
maybeScrabble
=
abort
"placeword could not retrieve WState from Scrabble window."
|
otherwise
#
pst
=
placeword`
(
fromJust
maybeScrabble
)
pst
#
pst
=
setActiveControl
editId
pst
#
pst
=
appPIO
(
setEditControlSelection
editId
1
0
)
pst
=
pst
placeword`
::
WState
(
PSt
*
State
)
->
PSt
*
State
placeword`
info
pst
=:{
ls
=
t
=:{
board
...
...
ObjectIO/ObjectIO/OS Windows/oswindow.dcl
View file @
4621ec02
...
...
@@ -560,6 +560,8 @@ osSetPopUpControlSize :: !OSWindowPtr !(!Int,!Int) !OSWindowPtr !(!Int,!Int) !
returns the current content of the edit control.
osSetEditControlCursor parentWindow editPtr clipRect itemRect pos
sets the cursor position at pos of the edit control while clipping.
osSetEditControlSelection parentWindow editPtr clipRect itemRect start end
sets the selection of the text in the edit control while clipping.
osSetEditControlSelect parentWindow editPtr clipRect toAble
enables the edit control (if toAble), or disables the edit control (if (not toAble)), while clipping.
osSetEditControlShow parentWindow editPtr clipRect show
...
...
@@ -572,6 +574,7 @@ osSetPopUpControlSize :: !OSWindowPtr !(!Int,!Int) !OSWindowPtr !(!Int,!Int) !
osSetEditControlText
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
OSRect
!
Bool
!
String
!*
OSToolbox
->
*
OSToolbox
osGetEditControlText
::
!
OSWindowPtr
!
OSWindowPtr
!*
OSToolbox
->
(!
String
,!*
OSToolbox
)
osSetEditControlCursor
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
OSRect
!
Int
!*
OSToolbox
->
*
OSToolbox
osSetEditControlSelection
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
OSRect
!
Int
!
Int
!*
OSToolbox
->
*
OSToolbox
osSetEditControlSelect
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
Bool
!*
OSToolbox
->
*
OSToolbox
osSetEditControlShow
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
Bool
!*
OSToolbox
->
*
OSToolbox
osSetEditControlPos
::
!
OSWindowPtr
!(!
Int
,!
Int
)
!
OSWindowPtr
!(!
Int
,!
Int
)
!(!
Int
,!
Int
)
!
Bool
!*
OSToolbox
->
*
OSToolbox
...
...
ObjectIO/ObjectIO/OS Windows/oswindow.icl
View file @
4621ec02
...
...
@@ -1350,6 +1350,10 @@ osSetEditControlCursor :: !OSWindowPtr !OSWindowPtr !OSRect !OSRect !Int !*OSToo
osSetEditControlCursor
_
ePtr
_
_
pos
tb
=
winSetEditSelection
ePtr
pos
(
pos
+1
)
tb
osSetEditControlSelection
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
OSRect
!
Int
!
Int
!*
OSToolbox
->
*
OSToolbox
osSetEditControlSelection
_
ePtr
_
_
start
end
tb
=
winSetEditSelection
ePtr
start
end
tb
osSetEditControlSelect
::
!
OSWindowPtr
!
OSWindowPtr
!
OSRect
!
Bool
!*
OSToolbox
->
*
OSToolbox
osSetEditControlSelect
_
ePtr
_
select
tb
=
winEnableControl
ePtr
select
tb
...
...
ObjectIO/ObjectIO/StdControl.dcl
View file @
4621ec02
...
...
@@ -6,7 +6,7 @@ definition module StdControl
//
// StdControl specifies all control operations.
// Author: Peter Achten
// Modified:
15 Octo
ber 2001
for Clean 2.0
// Modified:
20 Novem
ber 2001
(setEditControlSelection added).
// ********************************************************************************
...
...
@@ -160,6 +160,16 @@ setEditControlCursor :: !Id !Int !(IOSt .l) -> IOSt .l
content.
*/
setEditControlSelection
::
!
Id
!
Int
!
Int
!(
IOSt
.
l
)
->
IOSt
.
l
/* setEditControlSelection sets the new selection starting at position @2 until
@3 in the current content of the indicated EditControl.
In case @2<=@3, then the selection starts at @2 and ends at @3, with @2
taken to be atleast 0, and @3 taken to be at most (size content).
In case @2> @3, then the whole text is selected.
The indicated control must be the active EditControl (use setActiveControl in
StdWindow), otherwise this function has no effect.
*/
setControlLooks
::
![(
Id
,
Bool
,(
Bool
,
Look
))]
!(
IOSt
.
l
)
->
IOSt
.
l
setControlLook
::
!
Id
!
Bool
(
Bool
,
Look
)
!(
IOSt
.
l
)
->
IOSt
.
l
/* setControlLook(s) sets the (render,look) attribute of the indicated
...
...
ObjectIO/ObjectIO/StdControl.icl
View file @
4621ec02
...
...
@@ -662,6 +662,26 @@ where
=
{
wState
&
wRep
=
wH
,
wTb
=
tb
}
// Set the selection of an EditControl.
setEditControlSelection
::
!
Id
!
Int
!
Int
!(
IOSt
.
l
)
->
IOSt
.
l
setEditControlSelection
cId
begin
end
ioState
#
(
ioId
,
ioState
)
=
ioStGetIOId
ioState
#
(
maybeParent
,
ioState
)
=
ioStGetIdParent
cId
ioState
|
not
(
fst
(
isOkControlId
ioId
(
cId
,
maybeParent
)))
=
ioState
|
otherwise
=
setWindow
(
fromJust
maybeParent
).
idpId
(
setEditControlSelection`
cId
begin`
end`
)
ioState
where
(
begin`
,
end`
)
=
if
(
begin
<=
end
)
(
begin
,
end
)
(
0
,
-1
)
setEditControlSelection`
::
!
Id
!
Int
!
Int
!*
WState
->
*
WState
setEditControlSelection`
id
begin
end
wState
=:{
wIds
={
wPtr
},
wRep
,
wTb
,
wMetrics
}
#
(
wH
,
tb
)
=
seteditcontrolselection
id
begin
end
wMetrics
wPtr
wRep
wTb
=
{
wState
&
wRep
=
wH
,
wTb
=
tb
}
/* Change the Look of the corresponding (Custom(Button)/Compound)Controls and redraw
only if the first Boolean is True.
*/
...
...
ObjectIO/ObjectIO/StdWindow.icl
View file @
4621ec02
...
...
@@ -277,7 +277,7 @@ where
|
not
found
=
stdWindowFatalError
"setActiveControl"
"indicated control could not be located"
|
otherwise
// # keyfocus = setNewFocusItem itemNr whKeyFocus
// # keyfocus = setNewFocusItem itemNr whKeyFocus
This should be done via (de)activate-event
#
(
delayinfo
,
tb
)
=
osActivateControl
wshIds
.
wPtr
itemPtr
tb
=
(
delayinfo
,{
wsH
&
wshHandle
=
Just
{
wlsH
&
wlsHandle
={
wH
&
/*whKeyFocus=keyfocus,*/
whItems
=
itemHs
}}},
tb
)
where
...
...
ObjectIO/ObjectIO/controlinternal.dcl
View file @
4621ec02
...
...
@@ -5,7 +5,7 @@ definition module controlinternal
// Clean Standard Object I/O library, version 1.2.2
//
// Author: Peter Achten
// Modified:
7 Sept
ember 2001
for Clean 2.0
// Modified:
20 Nov
ember 2001
(seteditcontrolselection added).
// ********************************************************************************
...
...
@@ -19,6 +19,7 @@ setcontrolsshowstate :: ![Id] !Bool !OSWindowMetrics !WIDS
setcontrolsmarkstate
::
!
Id
!
MarkState
![
Index
]
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
setcontroltexts
::
![(
Id
,
String
)]
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
seteditcontrolcursor
::
!
Id
!
Int
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
seteditcontrolselection
::
!
Id
!
Int
!
Int
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
setcontrolslook
::
![(
Id
,
Bool
,(
Bool
,
Look
))]
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
drawincontrol
::
!
Id
!.(
St
*
Picture
.
x
)
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
*(!
Maybe
.
x
,!
WindowHandle`
,!*
OSToolbox
)
setslidercontrolstates
::
![(
Id
,
IdFun
SliderState
)]
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,
!*
OSToolbox
)
...
...
ObjectIO/ObjectIO/controlinternal.icl
View file @
4621ec02
...
...
@@ -604,6 +604,44 @@ where
=
(
False
,
itemH
,
tb
)
// Set the text selection of an EditControl, and handle proper feedback.
seteditcontrolselection
::
!
Id
!
Int
!
Int
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,!*
OSToolbox
)
seteditcontrolselection
id
begin
end
wMetrics
wPtr
wH`
=:{
whItems`
,
whSize`
,
whWindowInfo`
}
tb
#
(_,
itemHs
,
tb
)
=
setWElement
(
setEditSelection
wMetrics
wPtr
True
clipRect
begin
end
)
id
whItems`
tb
=
({
wH`
&
whItems`
=
itemHs
},
tb
)
where
clipRect
=
getContentRect
wMetrics
whWindowInfo`
whSize`
setEditSelection
::
!
OSWindowMetrics
!
OSWindowPtr
!
Bool
!
OSRect
!
Int
!
Int
!
Id
!
WItemHandle`
!*
OSToolbox
->
(!
Bool
,!
WItemHandle`
,!*
OSToolbox
)
setEditSelection
wMetrics
wPtr
shownContext
clipRect
begin
end
id
itemH
=:{
wItemKind`
=
IsEditControl
}
tb
|
not
(
identifyMaybeId
id
itemH
.
wItemId`
)
=
(
False
,
itemH
,
tb
)
|
otherwise
#
itemRect
=
posSizeToRect
itemH
.
wItemPos`
itemH
.
wItemSize`
#
tb
=
osSetEditControlSelection
wPtr
itemH
.
wItemPtr`
clipRect
itemRect
begin
end
tb
=
(
True
,
itemH
,
tb
)
setEditSelection
wMetrics
wPtr
shownContext
clipRect
begin
end
id
itemH
=:{
wItemKind`
=
IsCompoundControl
}
tb
#
(
found
,
itemHs
,
tb
)
=
setWElement
(
setEditSelection
wMetrics
wPtr
shownContext1
clipRect1
begin
end
)
id
itemH
.
wItems`
tb
=
(
found
,{
itemH
&
wItems`
=
itemHs
},
tb
)
where
info
=
getWItemCompoundInfo`
itemH
.
wItemInfo`
clipRect1
=
intersectRectContent
wMetrics
clipRect
info
itemH
.
wItemPos`
itemH
.
wItemSize`
shownContext1
=
shownContext
&&
itemH
.
wItemShow`
setEditSelection
wMetrics
wPtr
shownContext
clipRect
begin
end
id
itemH
=:{
wItemKind`
=
IsLayoutControl
}
tb
#
(
found
,
itemHs
,
tb
)
=
setWElement
(
setEditSelection
wMetrics
wPtr
shownContext1
clipRect1
begin
end
)
id
itemH
.
wItems`
tb
=
(
found
,{
itemH
&
wItems`
=
itemHs
},
tb
)
where
clipRect1
=
intersectRects
clipRect
(
posSizeToRect
itemH
.
wItemPos`
itemH
.
wItemSize`
)
shownContext1
=
shownContext
&&
itemH
.
wItemShow`
setEditSelection
_
_
_
_
_
_
_
itemH
tb
=
(
False
,
itemH
,
tb
)
// Set the look of a control, and handle proper feedback.
setcontrolslook
::
![(
Id
,
Bool
,(
Bool
,
Look
))]
!
OSWindowMetrics
!
OSWindowPtr
!
WindowHandle`
!*
OSToolbox
->
(!
WindowHandle`
,!*
OSToolbox
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment