Restored from previous forum. Originally posted by El_Choni.
Hi,
This question is for Fred or Danilo, but if anybody else has an answer, I'll be glad to hear it. The question is: how can I make a User library function accept a variable parameter number, like StrF() or CallCOM()?
Thanks a lot. Bye,
El_Choni
Variable parameters number in User lib functions
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by fred.
Just use the following syntax in your .DESC:
And build 2 functions:
PB_AddGadgetItem : This one takes 3 parameters
PB_AddGadgetItem2 : This one takes 4 parameters
If you need more optional parameter, it's possible:
Then you will have:
PB_CallFunction : 2 params
PB_CallFunction2 : 3 params
PB_CallFunction3 : 4 params
....
And you can even group optionnal params:
TestFunction, Long, [Long, Long], [Long]...
You will have:
PB_TestFunction: 1 param
PB_TestFunction2: 3 params
PB_TestFunction3: 4 params
I hope this help !
Fred - AlphaSND
Just use the following syntax in your .DESC:
Code: Select all
AddGadgetItem, Long, Long, String, [Long], (#Gadget, Position, Text$ [, ImageID]) - Add an item to a gadget (ListView, ComboBox etc...)
None | DebuggerCheck
PB_AddGadgetItem : This one takes 3 parameters
PB_AddGadgetItem2 : This one takes 4 parameters
If you need more optional parameter, it's possible:
Code: Select all
CallFunction, Long, String, [Long], [Long], [Long]...
PB_CallFunction : 2 params
PB_CallFunction2 : 3 params
PB_CallFunction3 : 4 params
....
And you can even group optionnal params:
TestFunction, Long, [Long, Long], [Long]...
You will have:
PB_TestFunction: 1 param
PB_TestFunction2: 3 params
PB_TestFunction3: 4 params
I hope this help !
Fred - AlphaSND
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
-
BackupUser
- PureBasic Guru

- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm