KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

KiXforms Version 2.3.0 Beta 1 Features

 
Post new topic   Reply to topic    KiXforms Forum Index -> Announcements/FAQs
View previous topic :: View next topic  
Author Message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Mar 13, 2003 3:01 pm    Post subject: KiXforms Version 2.3.0 Beta 1 Features Reply with quote

This is the first of a series of topics that will document all of the new features in the latest beta release of Kixforms. For general discussion and questions, please post to the Beta discussion thread in the Discussion forum.

Anchor Property

Gets or sets which edges of the control are anchored to the edges of its container.

Syntax

object.Anchor = [ integer ]

integer
A bitwise combination of the following values:

0 - None. The control is not anchored to any edges of its container.
1 - Left. The control is anchored to the left edge of its container.
2 - Top. The control is anchored to the top edge of its container.
4 - Right. The control is anchored to the right edge of its container.
8 - Bottom. The control is anchored to the bottom edge of its container.

The default is Left and Top.

Remarks

A control can be anchored to one or more edges of its parent container. Anchoring a control to its parent ensures that the anchored edges remain in the same position relative to the edges of the parent container when the parent container is resized. For example, if you have a Form with a Button whose Anchor property value is set to Top and Bottom, the Button is stretched to maintain the anchored distance to the top and bottom edges of the Form as the Height of the Form is increased.

The following example creates a form that contains a editable area (implemented as a TextBox) and an Exit button (implemented as a ToolButton). The desired effect is that as the form is resized, the TextBox should stretch in all four directions to maintain its size relative to the form. The Exit button should just simply "stick" to the inside top right edge of the form, moving as the form is resized.

For the TextBox to stretch in all four directions, the Anchor property should have all the bitwise anchor settings enabled, example 1+2+4+8 for a value of 15 (all sides). The ToolButton should only be attached to the top and right of the form, so that would imply a setting of 2+4 (top and right) for a value of 6.

Code:

Break On

$Form = CreateObject("Kixtart.Form")
$Form.ClientSize = 400,300
$Form.BorderStyle = 2 ; Resizable border

$TextBox = $Form.TextBox
$TextBox.MultiLine = 1
$TextBox.Location = 10,10
$TextBox.Right = $Form.ClientWidth - 100
$TextBox.Bottom = $Form.ClientHeight - 10
$TextBox.Anchor = 1+2+4+8 ; all sides

$Button = $Form.ToolButton
$Button.Top = 10
$Button.Left = $TextBox.Right + 10
$Button.Text = "Exit"
$Button.Icon = 9
$Button.OnClick = "Quit()"
$Button.Anchor = 2+4 ; just top and right

$Form.Center
$Form.Show
While $Form.Visible
 $=Execute($Form.DoEvents)
Loop

Exit 1
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Announcements/FAQs All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group