I've loaded XLSheetToArray and the Watch list shows that it's imported "0: ARRAY_10_1=36412"
I'm trying to create a dialog button that can use variables as names.
Every day the macro runs new, it will load the xls sheet to the array (new excel sheet every day)
The excel sheet can have anywhere from 1 to 40 lines.
I'd like to create say 40 buttons and name each one with what is in ARRAY_(1-40)_1
However when I set Caption = 'ARRAY_2_1' or even tried using %%. it just displays what is in the box.
I've also tried removing the quotes", then I just get errors
Is this something that can't be done?
I'm using MS 14.1
Thanks in advance
Mark
Naming buttons in Dialog with array info
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Naming buttons in Dialog with array info
Hi,
Object names are static and set in stone. They are not something the user sees. So, no, you can't do that I'm afraid.
The Caption is what the user sees.
Object names are static and set in stone. They are not something the user sees. So, no, you can't do that I'm afraid.
The Caption is what the user sees.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Naming buttons in Dialog with array info
Wouldn't it be possible to change the object names if you put the dialog code into a label and then use LabeltoVar> to get it into a variable, then do the adjustments (buttons, names, captions etc) through some string work and finally use IncludefromVar> and Show> to get the modified dialog? (ie change object names before they get static)?
Re: Naming buttons in Dialog with array info
The caption is what I'm attempting to change with variables. Is that also set in stone?
Re: Naming buttons in Dialog with array info
Caption is just a parameter so very easy to change (eg use SetDialogProperty>)
For the buttons, one way could be to generate the buttons dynamically based on the Excel file, another way (easier) could be to create the 40 buttons in your dialog (with proper placement etc) and then you read the excel file, modify the captions and hide/disable the un-used buttons.
I guess you also want something to happen when you push buttons so you will need something to handle that as well.
For the buttons, one way could be to generate the buttons dynamically based on the Excel file, another way (easier) could be to create the 40 buttons in your dialog (with proper placement etc) and then you read the excel file, modify the captions and hide/disable the un-used buttons.
I guess you also want something to happen when you push buttons so you will need something to handle that as well.
Re: Naming buttons in Dialog with array info
Am I missing something?
The button is blank with this code.
I've tried not using %
The Array is loading as 0: ARRAY_2_1=36512 shows up in the watch list
So 36512 should be in the caption box
The button is blank with this code.
I've tried not using %
The Array is loading as 0: ARRAY_2_1=36512 shows up in the watch list
So 36512 should be in the caption box
Code: Select all
object WOButton1: tMSButton
Left = 61
Top = 61
Width = 75
Height = 25
Caption = ''
TabOrder = 0
DoBrowse = False
BrowseStyle = fbOpen
end
end
EndDialog>Dialog1
Show>Dialog1,
SetDialogProperty>Dialog1,WOButton1,Caption,%ARRAY_2_1%
Re: Naming buttons in Dialog with array info
In this case SetDialogProperty> needs to come before ShowDialog>. (The comma in Show>Dialog1, will make the dialog modal and execution will halt until the dialog is closed, ie it will not reach the SetDialogProperty until it is too late in your example).
Re: Naming buttons in Dialog with array info
OMG I love you!!!
Thank you!
Thank you!