View Full Version : window object border size
sulletf
09-17-2007, 06:17 AM
Hi,
I would like to have the choice to display data in a window or a view ; a window being a view, I defined a window to appear as a view :
<window datapath="obj:/objects/object" titlearea_inset_top="0" inset_top="0" inset_bottom="0" inset_left="0" inset_right="0" width="100" height="100">
<style bordersize="0" isdefault="true" bordercolor="white"/>
It works fine except for the remaining thin black border which the "bordersize" attribute of the "style" tag won't make disappear either.
According to the documentation, "style" is inherited from "basecomponent".
What is wrong in my code ?
gambetto
09-18-2007, 05:14 AM
<window datapath="obj:/objects/object" titlearea_inset_top="0" inset_top="101" inset_bottom="101" inset_left="101" inset_right="101" width="100" height="100"/>
sulletf
09-18-2007, 08:00 AM
Hi,
thanks but it did not work the way i wanted : all the window data is masked !
Any other idea ?
Thanks
senshi
09-22-2007, 03:22 AM
I don't really understand what you want to achieve: "[...] a window being a view [...]".
Do you just want to have a draggable view or do you want to display/hide at runtime a window's borders?
eyegony
09-22-2007, 06:47 AM
Try the following code to see if that's what you want.
Basically, the WindowOrView class extends window to add a boolean attribute called 'iswindow' - True: it's a window (default); False: the window dressing disappear. Use the checkbox in the window to switch between these 2 states.
<canvas>
<class name="WindowOrView" extends="window">
<!-- set this to False if you want the window resources to disappear -->
<attribute name="iswindow" type="boolean" value="true" setter="setIsWindow( iswindow )"/>
<event name="oniswindow"/>
<!-- the setter for iswindow -->
<method name="setIsWindow" args="value">
this.iswindow = value;
if ( this._initcomplete )
this.showOrHideWindowResources();
if ( this['oniswindow'] )
this.oniswindow.sendEvent( this.iswindow );
</method>
<!-- Show or hide the window skin/border resources, title area, resize
controls, etc., based on the value of iswindow.
(see lz/windowpanel.lzx) -->
<method name="showOrHideWindowResources"> <![CDATA[
// comment/uncomment these lines to see the effect
// 'top', 'middle', and 'bottom' are window skin
// they are resizeview_x objects (see base/resizeview.lzx)
this.top.setVisible( this.iswindow );
this.middle.setVisible( this.iswindow );
this.bottom.setVisible( this.iswindow );
// the left and right grippers in the title_area
//this.title_area.gripper_left.setVisible( this.iswindow );
//this.title_area.gripper_right.setVisible( this.iswindow );
// or just turn the whole title_area on/off if you like
this.title_area.setVisible( this.iswindow );
// because title_area may contain other subviews like icon, title, and
// controls (including the close button)
// the following subviews are defined in window class (lz/window.lzx)
// wframe is the surrounding 1-px border with bgcolor 0x6A6A6A
// we'll make it disappear by setting its bgcolor to null
this.wframe.setBGColor( this.iswindow? 0x6A6A6A : null );
// cannot set its visible to false cause it will make content disappear
// (wcontent is inside wframe; wcontent is the defaultplacement of window)
// the resize control (created only if resizable is True)
//if ( this.resizable )
// this._resizeControl.setVisible( this.iswindow );
// or just set resizable to true/false
this.setAttribute( 'resizable', this.resizable && this.iswindow );
]]> </method>
</class>
<WindowOrView iswindow="${cb.value}" width="150" height="100">
<checkbox name="cb" value="true">iswindow</checkbox>
</WindowOrView>
</canvas>
Modify the code to do other things you like. You may need to study the windowpanel code in the library (lz/windowpanel.lzx). windowpanel is the one that provides the window borders/background etc.; window extends windowpanel to add other things like menubar, toolbar, and the resize control.
style.bordersize is actually not used by windowpanel; only basecolor, textcolor, and bgcolor are used (see _applystyle() method in windowpanel).
Hope this helps.
sulletf
09-25-2007, 12:22 AM
For you Senshi : I want a user to be able to change data display parameters from a simple view to a window, and the other way round.
A window being an extension of a view, i supposed I could display a window as a view by changing window attributes. It actually works fine by setting the attributes like i did but not for the borderline which is still visible ...
sulletf
09-25-2007, 12:34 AM
HeHe that works fine eyegony, your the man !
Cheers !
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.