SRL Archive - Help and Support

Making this read only.


Wanted

2007-06-15 14:50:23

Does anyone know how to make a combo box read only I know you can for edits , but I'm not sure how to make a combo box read only, some one know?

bullzeye95

2007-06-15 14:56:41

You mean so you can only choose options, not type stuff in too? In that case, set its Style to csDropDownList.

Wanted

2007-06-15 15:25:30

Is there another way, because that way I can't make loaded settings appear when the form starts up :(

Markus

2007-06-15 15:26:55

First let it load everything, and then change the style.

Wanted

2007-06-15 15:33:49

I did, that doesn't work either.

Is there a way of just disabling people to type in it?

If not that's ok, It's not really necessary…

Smartzkid

2007-06-15 15:43:58

Combobox1.Enabled := false?

Wanted

2007-06-15 15:47:55

Lol, I just tried that.

It loads the setting but you can't change the box at ALL. :(

Markus

2007-06-15 15:50:56

From: Icefire908
Lol, I just tried that.

It loads the setting but you can't change the box at ALL. :(


You mean you can't choose within the box?

bullzeye95

2007-06-15 15:53:12

Well just use trial and error. All the different settings for the style start with cs, so just do a ctrl + space, and go down the list.

Spky

2007-06-15 16:13:02

.Style:= csOwnerDrawFixed;
Tadah.

Starblaster100

2007-06-15 16:18:21

[php]combobox.style := csDropDownList;[/php]
I think

Bobarkinator

2007-06-15 16:26:45

Star did you read the whole thread lol? He said that didn't work.

Secet

2007-06-15 16:37:49

Do you mean itemindex?

Spky

2007-06-15 16:52:04

I will quote myself to avoid any further pointless posting.

From: Spky
.Style:= csOwnerDrawFixed;
Tadah.

Wanted

2007-06-15 16:56:21

From: Spky
.Style:= csOwnerDrawFixed;
Tadah.


Ah I've that didn't work either (load setting won't work for custom player form)…and I've tried everything…

but I didn't really need it, oh well…

I guess it can't be done (with out a plugin that is :stirthepot:)

Spky

2007-06-15 16:58:44

Post your script with that setting because it sure as hell should work.

Wanted

2007-06-15 17:03:20

I'm not going to post the script because it's supposed to be a big secret ;), but what you suggested and clDropDownList worked but the setting from data file in the player array would not load in the box and I know that it can't be done with out a plug in. Thanks for the help though, I'll be sure to remember how to make read only combo boxes in the future :).

Edit:
From: Starblaster100
[php]combobox.style := csDropDownList;[/php]
I think

Ah Crap, I just ran stress miner to test to see if you had that working in your script, forgot I was on a different user account on my computer (Same computer, Same IP) - Auth Auto Banned :(

Spky

2007-06-15 17:20:47

Is it because scar doesn't recognise the LoadFromFile procedure for TStrings? Because SCAR Divi doesn't have it.

Wanted

2007-06-15 17:27:19

Actually, the data file loads the settings from a data file (GetFileData) and then puts that in the player array accordingly (that part works fine), then I use my own custom LoadPlayersInForm to put the correct setting in the edit box.

Here's basically what it does for loading in the box for player array when a setting needs to be loaded or you need to switch players in the player form.

TheComboBox.Text := Players[No].String2;

The only problem I have with it is people might highlight the text in the combo box and type something in for whatever reason, then that screws up the whole script, but I'm trusting people to be smart enough to just select an pre-made option.

So I should be just fine, just thought it wouldn't hurt to find out if there was a 'fool' proof….

SKy Scripter

2007-06-15 18:46:44

lol you could always do somthing like this … kinda cheesy though :p



program New;

var
MainForm : TForm;
ComboBox : TCOMBOBOX;

procedure OnKeyPress(Sender: TObject; var Key: Char);
begin
Key := Chr(VK_CANCEL);
end;

procedure InitForm;
var
i : integer;
begin
MainForm := CreateForm;
MainForm.SetBounds(0, 0, 500, 400);
MainForm.POSITION:= poDesktopCenter;
MainForm.BORDERICONS:= [biMinimize, biSystemMenu];
MainForm.BORDERSTYLE:= bsSingle;
MainForm.Caption := 'SCAR Function Maker';

ComboBox := TCOMBOBOX.Create(MainForm);
ComboBox.Parent := MainForm;
ComboBox.SetBounds(100, 100, 100, 20);
for i := 1 to 5 do
ComboBox.Items.Add('Example' + inttostr(i));
ComboBox.Seltext := 'Example1';
ComboBox.OnKeyPress := @OnKeyPress;

MainForm.ShowModal;
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

begin
try
SafeInitForm;
finally
FreeForm(MainForm)
except
Writeln('ERROR: With Loading');
end;

end.

Wanted

2007-06-15 20:05:17

Wow, thanks SKy.

It works!