Using two FileBrowse Buttons with the same name in a Dialog
Moderators: Dorian (MJT support), JRL
Using two FileBrowse Buttons with the same name in a Dialog
I am trying to use two Buttons in a Dialog box to browse to, two different files. The script works provided that I have a different name on the Button, which is logical.
So I have one button with the caption "Browse" and the other with "Locate".
However, I would like the word Browse to be on both buttons.
Is there a way this can be done? In other works can a button be called something and display a different name? I noticed that the Buttons were named Button3 and Button4 when I went in and entered the caption. Is there a way to use "Button3" and "Button4" instead of the caption name.
So I have one button with the caption "Browse" and the other with "Locate".
However, I would like the word Browse to be on both buttons.
Is there a way this can be done? In other works can a button be called something and display a different name? I noticed that the Buttons were named Button3 and Button4 when I went in and entered the caption. Is there a way to use "Button3" and "Button4" instead of the caption name.
Another Catch to FileBrowse
Also, when using the FileBrowse Command twice the file type filter only works on the last one. Does anyone know of a way around this?
kpassaur,
I believe your first question can be solved by creating a .bmp file with the word "Browse" in it. then specifying that .bmp file in the button function of the dialog.
Dialog>Dialog1
Caption=Browse Button Test
Top=150
Width=270
Left=200
Height=200
Edit=msEdit1,104,8,121,
Edit=msEdit2,104,56,121,
Button=msButton1,24,112,75,25,0,c:\browse.bmp
Button=msButton2,152,112,75,25,0,c:\browse.bmp
Filebrowse=msButton1,msEdit1,*.bmp|Bitmap Files|*.txt|Text Files,open,C:\,Browse.bmp
Filebrowse=msButton2,msEdit2,*.bmp|Bitmap Files|*.txt|Text Files,open,C:\,Browse.bmp
EndDialog>Dialog1
As for your second question, I'm seeing strange results also. The first browse button sees all files and provides no filters, The second browse button shows filters but shows no files.
I'll look at this more Thursday if it hasn't been resolved, I'll be out all day tomorrow so no chance to do more testing until then.
Good luck,
Dick
I believe your first question can be solved by creating a .bmp file with the word "Browse" in it. then specifying that .bmp file in the button function of the dialog.
Dialog>Dialog1
Caption=Browse Button Test
Top=150
Width=270
Left=200
Height=200
Edit=msEdit1,104,8,121,
Edit=msEdit2,104,56,121,
Button=msButton1,24,112,75,25,0,c:\browse.bmp
Button=msButton2,152,112,75,25,0,c:\browse.bmp
Filebrowse=msButton1,msEdit1,*.bmp|Bitmap Files|*.txt|Text Files,open,C:\,Browse.bmp
Filebrowse=msButton2,msEdit2,*.bmp|Bitmap Files|*.txt|Text Files,open,C:\,Browse.bmp
EndDialog>Dialog1
As for your second question, I'm seeing strange results also. The first browse button sees all files and provides no filters, The second browse button shows filters but shows no files.
I'll look at this more Thursday if it hasn't been resolved, I'll be out all day tomorrow so no chance to do more testing until then.
Good luck,
Dick
So its not just me
Dick,
Thank you, after trying numerous things you get to the point where you thing it is you instead of the software. I'm glad to hear that it is not just me. Also, try a normal text box and updating it (manually type in new data) then try using the data.
For me this works if I don't have the GetDialogAction in the script, once I put it in I get the updated fields from the Filebrowse command but I don't get any other text box I changed. If I remove the GetDialogAction command it works fine except that the file browsed to doesn't work. I'm sure I am doing something wrong, but after 4 hours of trying everything I can think of I am better off exiting one dialog box and then entering anohter for the rest of the data.
Another thing I noticed is if I don't put a filter in the box such at Text Files|*.txt the file FileBrowse command will work with two boxes, however; if you specify a filter the last box works, but not the first. Again, I'm sure it is me.
Thank you, after trying numerous things you get to the point where you thing it is you instead of the software. I'm glad to hear that it is not just me. Also, try a normal text box and updating it (manually type in new data) then try using the data.
For me this works if I don't have the GetDialogAction in the script, once I put it in I get the updated fields from the Filebrowse command but I don't get any other text box I changed. If I remove the GetDialogAction command it works fine except that the file browsed to doesn't work. I'm sure I am doing something wrong, but after 4 hours of trying everything I can think of I am better off exiting one dialog box and then entering anohter for the rest of the data.
Another thing I noticed is if I don't put a filter in the box such at Text Files|*.txt the file FileBrowse command will work with two boxes, however; if you specify a filter the last box works, but not the first. Again, I'm sure it is me.
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
I think I have the same problem. Some times I compile the EXE there is written some strange stuff into the filetype field, sometimes the first filebrowse has the same filter as the second and so on.
This is my dialog:
Dialog>panel
Caption=Multi-Firmware-Download
Width=544
Height=310
Top=382
Left=486
Max=1
Min=1
Close=1
Resize=1
Image=C:\Documents and Settings\unp00608\Desktop\Multifirmware\rahmen.bmp,288,8,239,137
Image=C:\Documents and Settings\unp00608\Desktop\Multifirmware\rahmen.bmp,8,8,239,137
Label=P4LT_1 COM_port:,16,16
Label=P4LT_2 COM_port:,16,40
Label=P4LT_3 COM_port:,16,64
Label=P4LT_4 COM_port:,16,88
Label=P4LT_5 COM_port:,16,112
Label=P4LT_6 COM_port:,296,16
Label=P4LT_7 COM_port:,296,40
Label=P4LT_8 COM_port:,296,64
Label=P4LT_9 COM_port:,296,88
Label=P4LT_10 COM_port:,296,112
ComboBox=com1,112,16,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use1,Use On/Off,160,16,75,%sw1%
ComboBox=com2,112,40,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use2,Use On/Off,160,40,75,%sw2%
ComboBox=com3,112,64,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use3,Use On/Off,160,64,75,%sw3%
ComboBox=com4,112,88,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use4,Use On/Off,160,88,75,%sw4%
ComboBox=com5,112,112,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use5,Use On/Off,160,112,75,%sw5%
ComboBox=com6,392,16,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use6,Use On/Off,440,16,75,%sw6%
ComboBox=com7,392,40,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use7,Use On/Off,440,40,75,%sw7%
ComboBox=com8,392,64,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use8,Use On/Off,440,64,75,%sw8%
ComboBox=com9,392,88,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use9,Use On/Off,440,88,75,%sw9%
ComboBox=com10,392,112,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use10,Use On/Off,440,112,75,%sw10%
Label=HMI Location,8,164
Edit=fileH,104,160,353,%pathH%
Button=&Browse.,472,160,50,21,20,,Browse for the HMI600.exe
Filebrowse=&Browse.,fileH,Application|*.*
Label=Firmware Location,8,196
Edit=fileF,104,192,353,%pathF%
Button=&Browse..,474,192,50,21,21,,Browse for the firmware.ldr
Filebrowse=&Browse..,fileF,Loaderfile|*.ldr
Button=Start download,8,232,100,40,30,,Start the firmware download
Button=Exit Program,422,232,100,40,2,,Close the tool
Button=Close HMIs,284,232,100,40,40,,Close all open HMIs
Label=Wait with reset until all,136,240
Label=Firmwares are downloaded,130,255
EndDialog>panel
This is my dialog:
Dialog>panel
Caption=Multi-Firmware-Download
Width=544
Height=310
Top=382
Left=486
Max=1
Min=1
Close=1
Resize=1
Image=C:\Documents and Settings\unp00608\Desktop\Multifirmware\rahmen.bmp,288,8,239,137
Image=C:\Documents and Settings\unp00608\Desktop\Multifirmware\rahmen.bmp,8,8,239,137
Label=P4LT_1 COM_port:,16,16
Label=P4LT_2 COM_port:,16,40
Label=P4LT_3 COM_port:,16,64
Label=P4LT_4 COM_port:,16,88
Label=P4LT_5 COM_port:,16,112
Label=P4LT_6 COM_port:,296,16
Label=P4LT_7 COM_port:,296,40
Label=P4LT_8 COM_port:,296,64
Label=P4LT_9 COM_port:,296,88
Label=P4LT_10 COM_port:,296,112
ComboBox=com1,112,16,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use1,Use On/Off,160,16,75,%sw1%
ComboBox=com2,112,40,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use2,Use On/Off,160,40,75,%sw2%
ComboBox=com3,112,64,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use3,Use On/Off,160,64,75,%sw3%
ComboBox=com4,112,88,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use4,Use On/Off,160,88,75,%sw4%
ComboBox=com5,112,112,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use5,Use On/Off,160,112,75,%sw5%
ComboBox=com6,392,16,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use6,Use On/Off,440,16,75,%sw6%
ComboBox=com7,392,40,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use7,Use On/Off,440,40,75,%sw7%
ComboBox=com8,392,64,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use8,Use On/Off,440,64,75,%sw8%
ComboBox=com9,392,88,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use9,Use On/Off,440,88,75,%sw9%
ComboBox=com10,392,112,40,1%CRLF%2%CRLF%3%CRLF%4%CRLF%5%CRLF%6%CRLF%7%CRLF%8%CRLF%9%CRLF%10%CRLF%11%CRLF%12%CRLF%13%CRLF%14%CRLF%15%CRLF%16%CRLF%17%CRLF%18
CheckBox=use10,Use On/Off,440,112,75,%sw10%
Label=HMI Location,8,164
Edit=fileH,104,160,353,%pathH%
Button=&Browse.,472,160,50,21,20,,Browse for the HMI600.exe
Filebrowse=&Browse.,fileH,Application|*.*
Label=Firmware Location,8,196
Edit=fileF,104,192,353,%pathF%
Button=&Browse..,474,192,50,21,21,,Browse for the firmware.ldr
Filebrowse=&Browse..,fileF,Loaderfile|*.ldr
Button=Start download,8,232,100,40,30,,Start the firmware download
Button=Exit Program,422,232,100,40,2,,Close the tool
Button=Close HMIs,284,232,100,40,40,,Close all open HMIs
Label=Wait with reset until all,136,240
Label=Firmwares are downloaded,130,255
EndDialog>panel
I'm not sure when the problem with having two buttons with the same name was addressed. Although it appears to have been fixed.
The filebrowse issue was fixed by Support in October 2005.
See it here:
http://www.mjtnet.com/forum/viewtopic.p ... filebrowse
I just tested your dialog and was getting weird stuff in the "Files of type" field until I removed the ampersand (&) from the button name (and the "FileBrowse" name). After that, "files of type" field was correct and the file type specified was all that showed in the menu.
Kind of curious, why do you want the ampersand in the button name?
Hope this helps,
Dick
The filebrowse issue was fixed by Support in October 2005.
See it here:
http://www.mjtnet.com/forum/viewtopic.p ... filebrowse
I just tested your dialog and was getting weird stuff in the "Files of type" field until I removed the ampersand (&) from the button name (and the "FileBrowse" name). After that, "files of type" field was correct and the file type specified was all that showed in the menu.
Kind of curious, why do you want the ampersand in the button name?
Hope this helps,
Dick
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
I do not need these ampersand, there were in the code when I began to edit it.
Now I removed them and added a exe-Filter to the first field. Try out now, what happens:
In both filebrowse is now the loaderfile-Filter active And the last saveplace is also not stored.
The code remains the same, but this changed:
Label=HMI Location,8,164
Edit=fileH,104,160,353,%pathH%
Button=Browse.,472,160,50,21,20,,Browse for the HMI600.exe
Filebrowse=Browse.,fileH,Application|*.exe
Label=Firmware Location,8,196
Edit=fileF,104,192,353,%pathF%
Button=Browse..,474,192,50,21,21,,Browse for the firmware.ldr
Filebrowse=Browse..,fileF,Loaderfile|*.ldr
Remarkment: The Dialog results are all stored and recovered from the registry.
Now I removed them and added a exe-Filter to the first field. Try out now, what happens:
In both filebrowse is now the loaderfile-Filter active And the last saveplace is also not stored.
The code remains the same, but this changed:
Label=HMI Location,8,164
Edit=fileH,104,160,353,%pathH%
Button=Browse.,472,160,50,21,20,,Browse for the HMI600.exe
Filebrowse=Browse.,fileH,Application|*.exe
Label=Firmware Location,8,196
Edit=fileF,104,192,353,%pathF%
Button=Browse..,474,192,50,21,21,,Browse for the firmware.ldr
Filebrowse=Browse..,fileF,Loaderfile|*.ldr
Remarkment: The Dialog results are all stored and recovered from the registry.
Yes, I agree something is wrong and I don't know what it might be.
Here are my results.
If the first button is not set to look for (All Files|*.*), and the second button is set to look for (Loaderfiles|*.pdf) then the buttons seem to work correctly.
(I don't have any .ldr files so I substituted .pdf)
If the first button is not set to look for (Applications|*.exe), and the second button is set to look for (Loaderfiles|*.pdf) then the second button works and the first button fails to filter correctly. Oddly, I was getting different results with each opening and closing of the scipt even though I had made no changes to the script. Another odd thing is the "weird stuff in the "Files of type" field". I'm seeing extended ASCII characters, Looks like the field is swearing at me.
Took the script and cleaned it up as much as I could. I gave each button a unique name, I also reversed their order. Nothing that I tried helped.
This is what I ended up with.
Label=Firmware Location,8,196
Edit=fileF,104,192,353,
Button=Browse2,474,192,50,21,21
Filebrowse=Browse2,fileF,Loaderfile|*.pdf,open
Label=HMI Location,8,164
Edit=fileH,104,160,353,
Button=Browse1,472,160,50,21,20
Filebrowse=Browse1,fileH,Application|*.exe,open
Sorry I wasn't more help,
Dick
Here are my results.
If the first button is not set to look for (All Files|*.*), and the second button is set to look for (Loaderfiles|*.pdf) then the buttons seem to work correctly.
(I don't have any .ldr files so I substituted .pdf)
If the first button is not set to look for (Applications|*.exe), and the second button is set to look for (Loaderfiles|*.pdf) then the second button works and the first button fails to filter correctly. Oddly, I was getting different results with each opening and closing of the scipt even though I had made no changes to the script. Another odd thing is the "weird stuff in the "Files of type" field". I'm seeing extended ASCII characters, Looks like the field is swearing at me.
Took the script and cleaned it up as much as I could. I gave each button a unique name, I also reversed their order. Nothing that I tried helped.
This is what I ended up with.
Label=Firmware Location,8,196
Edit=fileF,104,192,353,
Button=Browse2,474,192,50,21,21
Filebrowse=Browse2,fileF,Loaderfile|*.pdf,open
Label=HMI Location,8,164
Edit=fileH,104,160,353,
Button=Browse1,472,160,50,21,20
Filebrowse=Browse1,fileH,Application|*.exe,open
Sorry I wasn't more help,
Dick
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
Thanks for the veryfication. I can't change it in a way which seem to work.
I had the %pathH% and %pathF% as values read out of the registry for setting a default. There is now another way to do this, but its verificated, it's not the fault.
I hope the Fix is also for Version 7.x as I couldn't convince my chef to buy the new version
I had the %pathH% and %pathF% as values read out of the registry for setting a default. There is now another way to do this, but its verificated, it's not the fault.
I hope the Fix is also for Version 7.x as I couldn't convince my chef to buy the new version
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
We'll have a look at this. Not sure what the issue is here, but it does seem as if more than one Filebrowse on the dialog causes problems.
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?
-
- Pro Scripter
- Posts: 58
- Joined: Mon Jun 27, 2005 7:03 am
- Location: Switzerland
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
I have emailed you a download to a production bug fix. Let me know if it sorts it.
I have emailed you a download to a production bug fix. Let me know if it sorts it.
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?