OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: XPS on 26 Jul 2006, 15:37:10

Title: Dialog trouble
Post by: XPS on 26 Jul 2006, 15:37:10
Hi,

I have a dialog with a few buttons and a listbox. When I click a button, I want to change the height of the listbox.
The problem is, you can change things in a dialog before you have opened it.

In this case the dialog is allready open (because you need to click on a button).

How can I do this?
Title: Re: Dialog trouble
Post by: nindall on 26 Jul 2006, 18:41:55
I would guess you're using global variables to change the value, if so just close the dialog & then create it again (AFAIK, there isn't a better way) -

Code: [Select]
closeDialog 0
_dlg = createDialog "Dialog"
? !(_dlg) : hint "Dialog error!"

Hope it'll work in your situation!
Title: Re: Dialog trouble
Post by: XPS on 27 Jul 2006, 01:53:31
Closing and opening the dialog is a good idea.
But I still don't know how to change the height of a listbox. Can anyone give me an example of that?

Thanks
Title: Re: Dialog trouble
Post by: benreeper on 27 Jul 2006, 03:37:57
In your dialogue you have to create 2 listboxes the sizes that you want, then you hide and unhide them as needed using the "ctrlshow" command.
--Ben
Title: Re: Dialog trouble
Post by: XPS on 27 Jul 2006, 13:46:31
So there is no possible way to give a variable to the height of the listbox.
And change that before you create a new dialog?
Title: Re: Dialog trouble
Post by: Igor Drukov on 27 Jul 2006, 14:55:44
Hey there !



There are ways, but :


In any case, just assign a global variable in the description.ext to what you want to change, and adjust the variable after closing the dialog and on re-creating it, as nindall suggested.
Title: Re: Dialog trouble
Post by: XPS on 27 Jul 2006, 15:08:23
Ah great.

The thing I did wrong:
I used _Height in my description.ext and my script.

I needed to use: Height
(Without underscore)  8)

So that is solved :D

But I need to know 1 more thing, what is the difference between a global variable and a local variable?
Is a variable with an underscore local or global?
Title: Re: Dialog trouble
Post by: Igor Drukov on 27 Jul 2006, 15:11:58
The answer is in what you've just written ;)

Underscore is local, without, global.
Title: Re: Dialog trouble
Post by: XPS on 27 Jul 2006, 15:37:25
Thanks  ;D