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

Trying to hide/view buttons...

 
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting
View previous topic :: View next topic  
Author Message
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Thu Jul 26, 2007 11:05 am    Post subject: Trying to hide/view buttons... Reply with quote

I am trying to convert an existing form to .net and cannot find the correct terms in the help documentation for the following structure.
Code:

$Form1
  $Groupbox1
     $Button1
     $Button2
     $Button#..
$Form1
  $Groupbox2
     $Button1
     $Button2
     $Button#..

On a conditional event I want to be able to HIDE or otherwise remove the 'button1's until the conditional event changes where I want to restore them.
I have used Kixforms.net to create the form but on applying the coding can not get a working means of doing this.

Does anyone know the correct method Question
________
Healthy Living Forums


Last edited by MACE1 on Fri Feb 18, 2011 5:12 pm; edited 1 time in total
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jul 26, 2007 11:59 am    Post subject: Reply with quote

Try to play with the .Visible property
_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jul 26, 2007 12:12 pm    Post subject: Reply with quote

Here's a quick example:

Code:

Break On

$System = CreateObject("Kixforms.System")

$Form = $System.Form()
$Form.ClientWidth = 400

$GroupBox1 = $Form.Controls.Add($System.GroupBox())
$GroupBox1.Text = "GroupBox1"

$Button11 = $GroupBox1.Controls.Add($System.Button())
$Button11.Text = "Button1"
$Button11.Top = 20
$Button11.Left = 10

$Button12 = $GroupBox1.Controls.Add($System.Button())
$Button12.Text = "Button2"
$Button12.Top = $Button11.Bottom + 5
$Button12.Left = 10

$GroupBox2 = $Form.Controls.Add($System.GroupBox())
$GroupBox2.Text = "GroupBox2"
$GroupBox2.Top = $GroupBox1.Bottom + 5

$Button21 = $GroupBox2.Controls.Add($System.Button())
$Button21.Text = "Button1"
$Button21.Top = 20
$Button21.Left = 10

$Button22 = $GroupBox2.Controls.Add($System.Button())
$Button22.Text = "Button2"
$Button22.Top = $Button21.Bottom + 5
$Button22.Left = 10

$HideButton = $Form.Controls.Add($System.Button())
$HideButton.Left = $GroupBox1.Right + 20
$HideButton.Top = $GroupBox1.Top + 5
$HideButton.Width = 100
$HideButton.Text = "Hide Button1"
$HideButton.Click = "HideButton_Click()"

$Form.Center
$Form.Show

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

Exit 0

Function HideButton_Click()

 If $Button11.Visible
  $Button11.Hide
  $Button21.Hide
  $HideButton.Text = "Show Button1"
 Else
  $Button11.Show
  $Button21.Show
  $HideButton.Text = "Hide Button1"
 Endif

EndFunction
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jul 26, 2007 12:30 pm    Post subject: Reply with quote

Shawn,

can't .Visible be set in kf.net ?

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Thu Jul 26, 2007 12:32 pm    Post subject: Reply with quote

Sure can, can do this:

Code:

Function HideButton_Click()

 If $Button11.Visible
  $Button11.Visible = 0
  $Button21.Visible = 0
  $HideButton.Text = "Show Button1"
 Else
  $Button11.Visible = 1
  $Button21.Visible = 1
  $HideButton.Text = "Hide Button1"
 Endif

EndFunction


Just a personal preference, I like using show/hide instead.
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Thu Jul 26, 2007 12:33 pm    Post subject: Reply with quote

10-4
_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
MACE1
KiXforms Enthusiast
KiXforms Enthusiast


Joined: 12 Oct 2004
Posts: 130
Location: Manchester UK

PostPosted: Thu Jul 26, 2007 4:09 pm    Post subject: Reply with quote

Very Happy
It was the syntax I could not fathom, thanks guys...

Also helps to note, every button has different name-number, and checking had repeat buttons names under different group boxes.
By renaming ALL buttons to be unique regardless of groupbox, should do the job...
________
Verona
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> Advanced Scripting 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