Page 2 of 2 <12
Topic Options
#87399 - 2002-08-23 03:22 AM Re: Kixforms: Enable and Textbox
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Alignment is your friend.

$textbox.alignment = 2 ; 0 = left, 1 = right, 2 - center

Top
#87400 - 2002-08-25 06:33 PM Re: Kixforms: Enable and Textbox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Was just experimenting with the VB TextBox ...

1) Disabling the TextBox turns the text grey. It does not accept or respond to any mouse or keyboard input. Setting the ForeColor of the text doesn't help - its still grey.

2) Locking the TextBox just makes the TextBox read-only. It still "responds" to mouse clicks and keyboard input - just that you can't add or delete or change any of the contents.

If I was needing something like a disabled textbox - but without the grey - I would tend to use a Label that looks like a textbox, example:

code:
;
; KIXTART 4.0
; KIXFORMS 2.0.3
;

Break On

$Form = CreateObject("Kixtart.Form")
$Form.FontSize = 10
$Form.Center

$Label = $Form.Label
$Label.Size = 200,200
$Label.Center
$Label.BackColor = 255,255,255
$Label.BorderStyle = 2

$Label.Text = "Currently running:" + @CRLF
$Label.Text = $Label.Text + " Kixtart Version : " + @KIX + @CRLF
$Label.Text = $Label.Text + " Kixforms Version : " + $Form.Version

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

Exit 1

-Shawn

[ 25. August 2002, 18:37: Message edited by: Shawn ]

Top
#87401 - 2002-08-28 02:03 PM Re: Kixforms: Enable and Textbox
Borte Offline
Fresh Scripter

Registered: 2002-08-20
Posts: 29
Loc: Europe / Norway
Shawn:

If I try this in VBA (don't have VB on this machine but as far as i know the function are the same)

1) Disabling the TextBox turns the text grey. It does not accept or respond to any mouse or keyboard input. Setting the ForeColor of the text doesn't help - its still grey.
- Same reponse as i get

2) Locking the TextBox just makes the TextBox read-only. It still "responds" to mouse clicks and keyboard input - just that you can't add or delete or change any of the contents.
- Same reponse as i get

3) Disabling AND locking the textbox makes the textbox read only without the grey, just like an label.

If needed contact me for an access example.

If I was needing something like a disabled textbox - but without the grey - I would tend to use a Label that looks like a textbox.
- I agree to the point that you could use a label, but that's not good for showing more text than the label can handle to the user.

Here's an sample of the VBA code that produces the function (taken from access):

code:
Private Sub Commando8_Click()
If Me.Text6.Enabled = True Then
Me.Text6.Enabled = False
Me.Commando8.Caption = "Disable"
Else
Me.Text6.Enabled = True
Me.Commando8.Caption = "Enable"
End If
End Sub



Private Sub Commando9_Click()
If Me.Text6.Locked = True Then
Me.Text6.Locked = False
Me.Commando9.Caption = "Lock"
Else
Me.Text6.Locked = True
Me.Kommando9.Caption = "UnLock"
End If
End Sub

This is an form using one textbox (Text6) and two commandbuttons (Command8 and Command9).
When pressing the different buttons the textbox cycles trough the different modes.

Borte

Top
#87402 - 2002-08-28 03:56 PM Re: Kixforms: Enable and Textbox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Borte, very good points ... this is exactly the kind of discussion that I hoped would evolve.

The interesting thing is - this is one of the areas where Access VBA and regular OFFICE VBA differ ... when I tried your example using an EXCEL form, the behavior was as I outlined ... I checked the OFFICE VBA docs and confirmed this as well.

I don't have ACCESS here, but I was reading the docs for ACCESS VBA and your right ... setting a TEXTBOX to DISABLED and LOCKED does not DIM the control ... strangely (?!) setting the control to DISABLED and UNLOCKED does DIM the control (according to the docs).

Heres another thing ... creating a multi-line (multi-page) TextBox that is DISABLED and LOCKED (not DIMMED) would do the job but the thing is ... it would need to be completely controlled and managed by the script code ... I would imagine that if SCROLLBARS where enabled ... but the control was DISABLED ... the user wouldn't be able to set focus to it, and manipulate the control in any way .. to see the extra amount of data ...

But here's the thing ... I'm not against trying to implement this feature from Office VBA ... in fact, VBA is the primary model from which KIXFORMS was built (not VB) ... Can you give me an example of how this feature would be used ... what would be displayed and what kind or user interaction would be expected ?

[ 28. August 2002, 16:22: Message edited by: Shawn ]

Top
#87403 - 2002-08-30 10:47 AM Re: Kixforms: Enable and Textbox
Borte Offline
Fresh Scripter

Registered: 2002-08-20
Posts: 29
Loc: Europe / Norway
I've just used this textbox function to display some information to the user, with the same "look" as the label field. The reason for why i'm jusing the textbox object and not the label is that the textbox object can hold much more text.

So if you're gonna show a lot of text to the user just as an information then the textbox with the "label" apperance is a good way to do this (at least that's my opinon), it also cleans up the form apperance i think.

What i've used this for in Kix is showing legal information to the user in the login form. This information is an total of 346 characters. I tried to put all this into the label object but it would only show the 2 first lines of text.
So I had to use 4 seperate label fields placed alongside each other to solve this.
If some one has any other way to do this then please tell me.

I'm not shure if this was the answer you were looking for Shawn but i've tried to explain how i've used it before.

Top
#87404 - 2002-09-03 02:46 AM Re: Kixforms: Enable and Textbox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
The label object "should" be able to show more than 346 chars of data, im thinking maybe its more of a forms bug, than anything else. For example, here's a script that's displays the Kixforms README.TXT file from the latest distribution. Its approx. 848 chars ...

code:
Break On

$Form = CreateObject("Kixtart.Form")
$Form.FontSize = 8
$Form.Size = 600,600

$Label = $Form.Label
$Label.Size = $Form.ClientWidth-20,$Form.ClientHeight-20
$Label.Location = 10,10
$Label.BorderStyle = 1

If Open(1,".\readme.txt") = 0
$Line = ReadLine(1)
While @Error = 0
$Label.Text = $Label.Text + $Line + @CRLF
$Line = ReadLine(1)
Loop
$=Close(1)
Endif

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

Exit 1

Can you post a snippet of code that demonstrates the specific problem .. the truncation that is ...

Top
#87405 - 2002-09-03 02:03 PM Re: Kixforms: Enable and Textbox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Actually, thinking more about it, the case of displaying a Legal Notice - where you want to be able to allow the user to navigate up and down - but not be able to select the text - is a good one. Let me dig deeper ...
Top
#87406 - 2002-09-03 03:05 PM Re: Kixforms: Enable and Textbox
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Vig,

Just "caught" your comments about ComboBoxes (I'm finally back at work now - and sometimes one has to print these threads to catch all the comments) ...

There are actually three "types" of ComboBoxes ... and I've only implemented one of them :

1) The Simple ComboBox - it looks like a TextBox with a ListBox underneath - the ListBox is always visible.

2) The DropDown ListBox - like a normal ComboBox - with a TextBox and a DropDown ListBox - but the TextBox is ReadOnly ... one cannot specify a custom value. Very common. Used when you don't want the user to select (type) a custom (unexpected) item. This is the one your referring to I think.

3) The DropDown ComboBox - the style that is currently supported. Like #2 except that one can edit the contents of the TextBox ... and provide a custom value.

I just haven't had time to implement the "other" two styles yet ... will be adding the STYLE property to these objects and will do so asap.

-Shawn

[ 03. September 2002, 15:05: Message edited by: Shawn ]

Top
#87407 - 2002-09-04 01:57 PM Re: Kixforms: Enable and Textbox
Borte Offline
Fresh Scripter

Registered: 2002-08-20
Posts: 29
Loc: Europe / Norway
Here's the code i've been using to show the legal text...:

code:
$Form               = CreateObject("Kixtart.Form")
$Form.Caption = "BLA BLA BLA..."
$Form.ScaleHeight = 500
$Form.ScaleWidth = 550
$Form.FontName = "Arial"
$Form.FontSize = 9
$Form.Center
$Form.moveable = 0
$Form.ResizeAble = 0
$Form.showintaskbar = 1
$Form.TitleBar = 1
$Form.TopMost = 1
$Form.BorderStyle = 1
$Form.MaxButton = 0
$Form.MinButton = 0

Global $lblLegal[3]
$lblLegal[0] = $form.label()
$lblLegal[1] = $form.label()
$lblLegal[2] = $form.label()
$lblLegal[3] = $form.label()

For Each $Label in $lblLegal
$Label.Alignment = 0
$Label.FontName = "arial"
$Label.FontBold = 0
$Label.FontSize = 7
$Label.Left = $fraLegal.Left + 10
Next

$lblLegal[0].Text = "BLA BLA BLA BLA LINE 1..."
$lblLegal[0].Top = $fraLegal.Top + 25
$lblLegal[0].Width = $fraLegal.Width - 20
$lblLegal[1].Text = "BLA BLA BLA BLA LINE 2..."
$lblLegal[1].Top = $lblLegal[0].Height + $lblLegal[0].Top
$lblLegal[1].Width = $fraLegal.Width - 20
$lblLegal[2].FontSize = 8
$lblLegal[2].Text = "BLA BLA BLA BLA LINE 3..."
$lblLegal[2].Top = $lblLegal[1].Height + $lblLegal[1].Top + 5
$lblLegal[2].Width = $fraLegal.Width - 20

I've removed the text as it was in norwegian (didn't think it was of any use).

I'm also looking for a way to disable the close botton in the form. How do i do that without changing/removing the border?

Regards
Borte

Top
#87408 - 2002-09-04 03:42 PM Re: Kixforms: Enable and Textbox
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
If you are interested in just showing a legal warning during login then you can use a regsitry key for this.

Please see Q101063 - How to Enable a Warning Message During Windows Logon Welcome and use the BBs search to find KiXtart implementations of the legal warning registry key.
_________________________
There are two types of vessels, submarines and targets.

Top
#87409 - 2002-09-04 04:03 PM Re: Kixforms: Enable and Textbox
Borte Offline
Fresh Scripter

Registered: 2002-08-20
Posts: 29
Loc: Europe / Norway
I know, but i'm jusing it in a dynamic form with an progress bar during logon so the user can read this while he waits for the logon to complete.

Mostly just as an "neat" future...

Top
Page 2 of 2 <12


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.059 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org