Can any one please let me know where the in-built code for Browse which we use in DXL is located? Thanks a ton in advance. KBSri - Thu Mar 13 02:17:34 EDT 2014 |
Re: Browse button code inbuilt in DXL Hi KBSri,
The question's not very clear unfortunately, but I'll have a go at answering it... Assuming you're looking to browse for a file on the disk or on the network, you probably need to check out the fileName DBE:
DBE fileName(DB box,
[string label,]
[,string initFileName
[,string extension,
string description
[,bool readOnly]]])
Where the actual code is located, I don't know... But I'm guessing it's hidden in an encrypted .inc file.
If you need to browse the database, then I'm afraid you will have to create a custom button and add a database explorer. There's nothing built-in for that.
Hope this helps.
Marcel |
Re: Browse button code inbuilt in DXL M_vdLaan - Thu Mar 13 04:54:36 EDT 2014 Hi KBSri,
The question's not very clear unfortunately, but I'll have a go at answering it... Assuming you're looking to browse for a file on the disk or on the network, you probably need to check out the fileName DBE:
DBE fileName(DB box,
[string label,]
[,string initFileName
[,string extension,
string description
[,bool readOnly]]])
Where the actual code is located, I don't know... But I'm guessing it's hidden in an encrypted .inc file.
If you need to browse the database, then I'm afraid you will have to create a custom button and add a database explorer. There's nothing built-in for that.
Hope this helps.
Marcel Let me precise in my question. I have function for BROWSE button. The function is: DBE dbeBrowse = null
void doBrowse(DBE db) The problem here is I am confused to store the function value inside the DBE Button here. I have called the particular function inside main() as : dbeBrowse = button(dbRunAll,"Browse", doBrowse) The requirement is that if we run the script it should pop a Dialog Box and then in that there should be Button exists for BROWSE where the user can select the file from the required directory. I am stuck with this.Any help is appreciated in this. |
Re: Browse button code inbuilt in DXL KBSri - Thu Mar 13 05:25:43 EDT 2014 Let me precise in my question. I have function for BROWSE button. The function is: DBE dbeBrowse = null
void doBrowse(DBE db) The problem here is I am confused to store the function value inside the DBE Button here. I have called the particular function inside main() as : dbeBrowse = button(dbRunAll,"Browse", doBrowse) The requirement is that if we run the script it should pop a Dialog Box and then in that there should be Button exists for BROWSE where the user can select the file from the required directory. I am stuck with this.Any help is appreciated in this. Okay, so you want the doBrowse callback to show a folder selection window. From there you want to store the path that was returned and have the script use it. As I see it, you can either make dirPath a global variable and store the path there, or you could add a text field next to the Browse button, for example, and set the value of the field when the doBrowse completes. You can even choose to maken that field read-only so it can only be set through the folder selection dialog, but the result can be seen afterwards. Try this and let us know if this is what you need.
DB dbMain
DBE dbeBrowse
DBE dbeFolder
void doBrowse(DBE db)
{
OleAutoObj objDialog = null
OleAutoObj objFolder = null
OleAutoObj objFolderItem = null
OleAutoArgs args = create
string folderPath = ""
string res = ""
objDialog = oleCreateAutoObject("Shell.Application")
if (null objDialog) {
print "Failed to create dialog object"
}
put(args, 0) // always zero
put(args, "Please select a folder") // title
put(args, 0) // options
//put(args, "c:\\temp") // root folder
res = oleMethod(objDialog, "BrowseForFolder", args, objFolder)
if (!null res) {
print "Failed to launch browser: " res "\n"
return
}
res = oleGet(objFolder, "Self", objFolderItem)
if (!null res) {
print("Failed to get folder item: " res)
return
}
res = oleGet(objFolderItem, "Path", folderPath)
if (!null res) {
print "Error getting path: " res "\n"
return
}
set(dbeFolder, folderPath)
oleCloseAutoObject objDialog
return
}
void doOk(DB db){
string sFolder = get(dbeFolder)
infoBox(dbMain, "You selected the folder " sFolder )
}
void main()
{
dbMain = create("Folder selection test")
dbeFolder = field(dbMain, "Folder", "Bla", 60, true)
dbeBrowse = button(dbMain, "Browse...", doBrowse)
dbeBrowse->"left"->"flush"->dbeFolder
dbeBrowse->"top"->"aligned"->dbeFolder
ok(dbMain, doOk)
realize dbMain
show dbMain
}
main()
|
Re: Browse button code inbuilt in DXL M_vdLaan - Thu Mar 13 07:42:59 EDT 2014 Okay, so you want the doBrowse callback to show a folder selection window. From there you want to store the path that was returned and have the script use it. As I see it, you can either make dirPath a global variable and store the path there, or you could add a text field next to the Browse button, for example, and set the value of the field when the doBrowse completes. You can even choose to maken that field read-only so it can only be set through the folder selection dialog, but the result can be seen afterwards. Try this and let us know if this is what you need.
DB dbMain
DBE dbeBrowse
DBE dbeFolder
void doBrowse(DBE db)
{
OleAutoObj objDialog = null
OleAutoObj objFolder = null
OleAutoObj objFolderItem = null
OleAutoArgs args = create
string folderPath = ""
string res = ""
objDialog = oleCreateAutoObject("Shell.Application")
if (null objDialog) {
print "Failed to create dialog object"
}
put(args, 0) // always zero
put(args, "Please select a folder") // title
put(args, 0) // options
//put(args, "c:\\temp") // root folder
res = oleMethod(objDialog, "BrowseForFolder", args, objFolder)
if (!null res) {
print "Failed to launch browser: " res "\n"
return
}
res = oleGet(objFolder, "Self", objFolderItem)
if (!null res) {
print("Failed to get folder item: " res)
return
}
res = oleGet(objFolderItem, "Path", folderPath)
if (!null res) {
print "Error getting path: " res "\n"
return
}
set(dbeFolder, folderPath)
oleCloseAutoObject objDialog
return
}
void doOk(DB db){
string sFolder = get(dbeFolder)
infoBox(dbMain, "You selected the folder " sFolder )
}
void main()
{
dbMain = create("Folder selection test")
dbeFolder = field(dbMain, "Folder", "Bla", 60, true)
dbeBrowse = button(dbMain, "Browse...", doBrowse)
dbeBrowse->"left"->"flush"->dbeFolder
dbeBrowse->"top"->"aligned"->dbeFolder
ok(dbMain, doOk)
realize dbMain
show dbMain
}
main()
Amazing!! Thanks a ton!Jus have one doubt here... This is selecting only the folder here...incase if you want to select a file. You have any suggestions on that? |
Re: Browse button code inbuilt in DXL KBSri - Thu Mar 13 08:13:46 EDT 2014 Amazing!! Thanks a ton!Jus have one doubt here... This is selecting only the folder here...incase if you want to select a file. You have any suggestions on that? I thought the whole object of the game was to select a folder only... I thought that's why you jumped through the OLE hoops... Selecting a single file is much easier (and built in):
DB dbMain
DBE dbeFile
void doOk(DB db){
string sFile = get(dbeFile)
infoBox(dbMain, "You selected the file " sFile )
}
void main()
{
dbMain = create("Folder selection test")
dbeFile = fileName(dbMain, "File", "")
ok(dbMain, doOk)
realize dbMain
show dbMain
}
main()
That's why I mentioned it in my first post.
Enjoy!
Marcel |
Re: Browse button code inbuilt in DXL M_vdLaan - Thu Mar 13 09:20:16 EDT 2014 I thought the whole object of the game was to select a folder only... I thought that's why you jumped through the OLE hoops... Selecting a single file is much easier (and built in):
DB dbMain
DBE dbeFile
void doOk(DB db){
string sFile = get(dbeFile)
infoBox(dbMain, "You selected the file " sFile )
}
void main()
{
dbMain = create("Folder selection test")
dbeFile = fileName(dbMain, "File", "")
ok(dbMain, doOk)
realize dbMain
show dbMain
}
main()
That's why I mentioned it in my first post.
Enjoy!
Marcel You are simply awesome!! |