Bidmaron
November 21st, 2017, 12:35
OK, what I am trying to achieve is to create what I call a dragline control that, when you hover over it or you drag it, the frame changes from a horizontal line to a horizontal line with double arrow vertical drag indicators spaced along the plain horizontal line. When you release the mouse, it is supposed to resize the preprocessor control by the amount you dragged the line up or down.
The problem I am having is that when you hover over the control, the frame does not change, and you cannot drag it.
The graphics I am using are the standard CoreRPG textline (which is 100 x 20 with the one pixel wide horizontal line at the 15th pixel [1-relative] down from the top) and the textline modified with a double-headed vertical arrow (5 pixels from left). Here are the two graphics:
TextLine:
21545
Dragline:
21546
Here are my frame definitions (quiescentdragline intended to be state at rest, dragline the state when hovering over control or dragging it):
<framedef name="dragline">
<bitmap file="dragline.png" />
<middle rect="0,11,40,9" />
</framedef>
<framedef name="quiescentdragline">
<bitmap file="textline.png" />
<middle rect="0,11,40,9" />
</framedef>
Here is what my window looks like with the preprocessor control being the one with all the text in it, and my dragline control right under it:
21547
Unfortunately, it looks the same when I try to hover over and drag the dragline control.
Here is my layered window definition with all these controls:
<windowclass name="table_main" merge="join">
<sheetdata merge="join">
<basicstring name="preprocessor">
<empty textres="generator_emptyforward" />
<anchored position="insidetop" offset="-5" height="60"/>
<invisible />
<multilinespacing>20</multilinespacing>
</basicstring>
<genericcontrol name="drag_line">
<anchored height="9">
<top parent="preprocessor" anchor="bottom" relation="absolute" offset="0,0" />
<left />
<right />
</anchored>
<frame name="quiescentdragline" />
<pressed name="dragline">
<nobaseframe />
</pressed>
<hover name="dragline">
<nobaseframe />
</hover>
<script>
local nYStart;
function onDragStart(button, x, y, dragdata)
nYStart=y;
end
function onDragEnd(button, x, y, dragdata)
local _,nOldHeight=preprocessor.getSize();
preprocessor.setAnchoredHeight(nOldHeight+y-nYStart);
nOldHeight=tabletoplabelanchor.getSize();
tabletoplabelanchor.setAnchoredHeight(nOldHeight+y-nYStart);
end
</script>
</genericcontrol>
<line_column name="divider3" />
<string_column_full name="postprocessor">
<empty textres="generator_emptyafterward" />
<invisible />
</string_column_full>
</sheetdata>
<script>
function onInit()
if TableManager.isGenerator(getDatabaseNode()) then
preprocessor.setAnchor("top","divider","bottom","absolute",5);
preprocessor.setVisible(true);
postprocessor.setVisible(true);
tabletoplabelanchor.setAnchor("top","columnanchor","bottom","relative",90);
else
divider3.setVisible(false);
dragline.setVisible(false);
end
super.onInit();
end
</script>
</windowclass>
The windowclass code is designed to make the window look like the normal table (TableManager.isGenerator returns false) or the enhanced Generators window (if it returns true). That all works just fine.
The script for the dragline control is supposed to save the y position at start of drag and then at end of drag adjust the height of the preprocessor control by the amount of the drag and to also make the same adjustment to the anchor that all of the legacy table controls are tied to.
The problem I am having is that when you hover over the control, the frame does not change, and you cannot drag it.
The graphics I am using are the standard CoreRPG textline (which is 100 x 20 with the one pixel wide horizontal line at the 15th pixel [1-relative] down from the top) and the textline modified with a double-headed vertical arrow (5 pixels from left). Here are the two graphics:
TextLine:
21545
Dragline:
21546
Here are my frame definitions (quiescentdragline intended to be state at rest, dragline the state when hovering over control or dragging it):
<framedef name="dragline">
<bitmap file="dragline.png" />
<middle rect="0,11,40,9" />
</framedef>
<framedef name="quiescentdragline">
<bitmap file="textline.png" />
<middle rect="0,11,40,9" />
</framedef>
Here is what my window looks like with the preprocessor control being the one with all the text in it, and my dragline control right under it:
21547
Unfortunately, it looks the same when I try to hover over and drag the dragline control.
Here is my layered window definition with all these controls:
<windowclass name="table_main" merge="join">
<sheetdata merge="join">
<basicstring name="preprocessor">
<empty textres="generator_emptyforward" />
<anchored position="insidetop" offset="-5" height="60"/>
<invisible />
<multilinespacing>20</multilinespacing>
</basicstring>
<genericcontrol name="drag_line">
<anchored height="9">
<top parent="preprocessor" anchor="bottom" relation="absolute" offset="0,0" />
<left />
<right />
</anchored>
<frame name="quiescentdragline" />
<pressed name="dragline">
<nobaseframe />
</pressed>
<hover name="dragline">
<nobaseframe />
</hover>
<script>
local nYStart;
function onDragStart(button, x, y, dragdata)
nYStart=y;
end
function onDragEnd(button, x, y, dragdata)
local _,nOldHeight=preprocessor.getSize();
preprocessor.setAnchoredHeight(nOldHeight+y-nYStart);
nOldHeight=tabletoplabelanchor.getSize();
tabletoplabelanchor.setAnchoredHeight(nOldHeight+y-nYStart);
end
</script>
</genericcontrol>
<line_column name="divider3" />
<string_column_full name="postprocessor">
<empty textres="generator_emptyafterward" />
<invisible />
</string_column_full>
</sheetdata>
<script>
function onInit()
if TableManager.isGenerator(getDatabaseNode()) then
preprocessor.setAnchor("top","divider","bottom","absolute",5);
preprocessor.setVisible(true);
postprocessor.setVisible(true);
tabletoplabelanchor.setAnchor("top","columnanchor","bottom","relative",90);
else
divider3.setVisible(false);
dragline.setVisible(false);
end
super.onInit();
end
</script>
</windowclass>
The windowclass code is designed to make the window look like the normal table (TableManager.isGenerator returns false) or the enhanced Generators window (if it returns true). That all works just fine.
The script for the dragline control is supposed to save the y position at start of drag and then at end of drag adjust the height of the preprocessor control by the amount of the drag and to also make the same adjustment to the anchor that all of the legacy table controls are tied to.