Redback
(Getting the hang of it)
2002-08-22 07:16 AM
Kixforms: Enable and Textbox

I have a textbox that I would like to display information in, I would like to prevent users from interacting with this text box, however I would like to do this without the textbox becoming 'grayed out'

anyone know of a way to do this?

suggestions on alternative ways to display this text will also be gratefully received

Thanks

Redback


Vig
(Starting to like KiXtart)
2002-08-22 07:48 AM
Re: Kixforms: Enable and Textbox

I'd like to know the same about ComboBox. Disable a ComboBox and you can no longer select from the list.

Schuliebug
(Hey THIS is FUN)
2002-08-22 08:59 AM
Re: Kixforms: Enable and Textbox

Redback,

For a textbox the property Locked should work. According to the manual this property is only for Textboxes. Maybe Shawn can add this also to ComboBox in future releases.


Fernando Madruga
(Starting to like KiXtart)
2002-08-22 10:11 AM
Re: Kixforms: Enable and Textbox

If you don't mind me asking: what's the point of having a "read-only" ComboBox? [Confused] If the user can't change the value, there's no point in letting him/her know what they are: (s)he can do nothing about it! [Smile]

Just curious,
Fernando Madruga


Borte
(Fresh Scripter)
2002-08-23 12:59 AM
Re: Kixforms: Enable and Textbox

I've posted this for a couple of days ago in this forum (another topic):

In VB is it possible to set an txtbox as enabled to false and locked to true to get a textbox look like an label, but with all the properties of an textbox. Is this possible in KixForms?
I've tried to achive this but the textbox is always ending up with the text grayed out.

The function would be fullfilled if the forecolor of this textbox didn't change to gray but stayed the same if the value locked is true and enabled is false.

Any ideas? [Confused]

I'm trying to show information to the user, but the text is to big to fit in one label field so i have to use multiple labels. Not a good solution!

Regards
Borte!


LonkeroAdministrator
(KiX Master Guru)
2002-08-22 01:03 PM
Re: Kixforms: Enable and Textbox

borte, haven't tried, but have you tried to set the background color after disabling it?

well, I did something similar on my user creation script but it uses listbox instead.


Borte
(Fresh Scripter)
2002-08-22 01:08 PM
Re: Kixforms: Enable and Textbox

Yes i've changed the backcolor to the forms color before locking it. When doing that the backcolor stays the same but the forecolor is grayed out.

I't would have been great to be able to use this function to show dynamically text to the user, instead of using labels!

Can listbox be disabled and still show text in normal color? I don't want the user to be able to select the text only read it.


LonkeroAdministrator
(KiX Master Guru)
2002-08-22 01:27 PM
Re: Kixforms: Enable and Textbox

well, user can still select it as I don't set it to not enabled.

but you can make event for it or the textbox you are using.

$listbox.ongotfocus="$$form.setfocus()"

then, any time user selects it, it get unselected.

give it a try.

cheers


Vig
(Starting to like KiXtart)
2002-08-22 02:48 PM
Re: Kixforms: Enable and Textbox

Fernando Madruga,

I'm not exactly sure what your asking. As is the combobox lets you edit the text in the drop down list. I want to disable being able to edit any of these values. Just to be sure were on the same sheet of music, I'm looking to make the combobox act the same as the Hop To: combobox on the bottom right of this webpage.


LonkeroAdministrator
(KiX Master Guru)
2002-08-22 02:51 PM
Re: Kixforms: Enable and Textbox

vig, that's why some of us are waiting for shawn to add menubox.

haven't actually heard about that for a while, but as I understood, such should be added.

.


Vig
(Starting to like KiXtart)
2002-08-22 03:00 PM
Re: Kixforms: Enable and Textbox

To keep the textbox text from changing couldn't you also use OnChange to set it back to the original text?

Something like:

$listbox.text = "Your Text"
$listbox.onchange = '$$listbox.text = "Your Text"'

Hmm nevermind that seems to throw it into a loop.


LonkeroAdministrator
(KiX Master Guru)
2002-08-22 03:03 PM
Re: Kixforms: Enable and Textbox

no, as listbox is not changeable.

it's only selectable. that's why removing the chance to select anything is easy to remove by taking of the focus.
it also trickers before onchange.

also, onclick is one way.


Vig
(Starting to like KiXtart)
2002-08-22 03:27 PM
Re: Kixforms: Enable and Textbox

Oops, sorry thought we were talking about a textbox.

LonkeroAdministrator
(KiX Master Guru)
2002-08-22 03:33 PM
Re: Kixforms: Enable and Textbox

but, actually, the box is not needed to be disabled as it can be made as disabled with those nice events.

Borte
(Fresh Scripter)
2002-08-22 04:00 PM
Re: Kixforms: Enable and Textbox

But the cursor will still change to tell the user that this field can be edited!

LonkeroAdministrator
(KiX Master Guru)
2002-08-22 04:40 PM
Re: Kixforms: Enable and Textbox

the cursor will change?
to what?

my cursor only changes to "I" which does not tell anything but that it's on text.


Borte
(Fresh Scripter)
2002-08-22 05:23 PM
Re: Kixforms: Enable and Textbox

Yes that's correct.

In VB if you set locked = True and Enabled = False will the cursor for the textbox not change to "I" and therefore not give any hint to the user that this field can be edited or selected (of course it can't be edited or selected because its locked and disabled)


LonkeroAdministrator
(KiX Master Guru)
2002-08-22 05:30 PM
Re: Kixforms: Enable and Textbox

well, it's vb.

if you move your mouse over normal text on the forum, you see that it's cursor changes.

it's just normal behaviour with normal text.

I don't think your users think that:
"hey, this can be changed"
because the cursor change happens.


Redback
(Getting the hang of it)
2002-08-23 01:29 AM
Re: Kixforms: Enable and Textbox

This works for me

$text.locked = 1

its not in the online manual though....

thanks Schuliebug

anyone know how to center the text in the box?


LonkeroAdministrator
(KiX Master Guru)
2002-08-23 02:05 AM
Re: Kixforms: Enable and Textbox

center text in text box.

I think it's only matter of simple calculation.

actually, I had some time ago login script with centered text and it looked really stupid.

anyway, all you need to know is the width and count the center point (/2) of the box and text...

well, you know.
as I know of, there is no method in forms itself.


Chris S.
(MM club member)
2002-08-23 03:22 AM
Re: Kixforms: Enable and Textbox

Alignment is your friend.

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


ShawnAdministrator
(KiX Supporter)
2002-08-25 06:33 PM
Re: Kixforms: Enable and Textbox

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 ]


Borte
(Fresh Scripter)
2002-08-28 02:03 PM
Re: Kixforms: Enable and Textbox

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


ShawnAdministrator
(KiX Supporter)
2002-08-28 03:56 PM
Re: Kixforms: Enable and Textbox

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 ]


Borte
(Fresh Scripter)
2002-08-30 10:47 AM
Re: Kixforms: Enable and Textbox

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.


ShawnAdministrator
(KiX Supporter)
2002-09-03 02:46 AM
Re: Kixforms: Enable and Textbox

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 ...


ShawnAdministrator
(KiX Supporter)
2002-09-03 02:03 PM
Re: Kixforms: Enable and Textbox

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 ...

ShawnAdministrator
(KiX Supporter)
2002-09-03 03:05 PM
Re: Kixforms: Enable and Textbox

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 ]


Borte
(Fresh Scripter)
2002-09-04 01:57 PM
Re: Kixforms: Enable and Textbox

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


Sealeopard
(KiX Master)
2002-09-04 03:42 PM
Re: Kixforms: Enable and Textbox

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.


Borte
(Fresh Scripter)
2002-09-04 04:03 PM
Re: Kixforms: Enable and Textbox

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...