This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathcom.livecode.pi.file.behavior.livecodescript
More file actions
78 lines (70 loc) · 2.11 KB
/
com.livecode.pi.file.behavior.livecodescript
File metadata and controls
78 lines (70 loc) · 2.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
script "com.livecode.pi.file.behavior"
local sPadding
on editorInitialize
set the editorMinWidth of me to 25
set the editorMaxWidth of me to 0
put the palettePadding of this stack into sPadding
end editorInitialize
on editorUpdate
lock screen
local tValue, tEffective, tEnabled
put the editorValue of me into tValue
put the editorEnabled of me into tEnabled
put the editorEffective of me into tEffective
lock messages
put tValue into field 1 of me
set the enabled of field 1 of me to tEnabled
if tEffective is true then
set the textcolor of field 1 of me to "150,150,150"
else
set the textcolor of field 1 of me to empty
end if
unlock messages
unlock screen
end editorUpdate
on editorResize
lock screen
lock messages
local tLeft,tTop,tRight,tBottom
put item 1 of the rect of me into tLeft
put item 2 of the rect of me into tTop
put item 3 of the rect of me into tRight
put item 4 of the rect of me into tBottom
set the rect of button 1 of me to tRight-the width of button 1 of me, tTop, tRight,tBottom
set the rect of field 1 of me to tLeft, tTop, tRight-the width of button 1 of me - sPadding, tBottom
unlock messages
unlock screen
end editorResize
on valueChanged
set the editorValue of me to field 1 of me
updateProperty
end valueChanged
on mouseUp pButton
local tOptions
put the editorOptions of me into tOptions
if the name of the target contains "button" and pButton is 1 then
if tOptions is not empty then
replace return with comma in tOptions
end if
local tResult
revIDEAnswerFileWithTypes tOptions
put the result into tResult
if there is a file tResult then
put tResult into field 1 of me
valueChanged
end if
end if
end mouseUp
on dragEnter
if the dragData["files"] is empty then
pass dragEnter
end if
set the dragAction to "link"
end dragEnter
on dragDrop
if the dragData["files"] is empty then
pass dragDrop
end if
set the text of field 1 of me to line 1 of the dragData["files"]
valueChanged
end dragDrop