TOPIC: Error using Access button from KeyListView
#1070
Error using Access button from KeyListView 2 Years, 7 Months ago
There is a problem when trying to use the Access button in KeyListView when the BookControl is not being used (if your application is not running inside a BookControl). The problem is that a program error is displayed instead of displaying the Access window.

The following is the definition for AccessGoTo with the problem resolved. The fix will also be in the next release.

Code:


// Copyright (C) 2003 Suneido Software Corp. All rights reserved worldwide.
// e.g. AccessGoTo('Ar_Invoices', 'arivc_num_new', false)
class
{
CallClass(access, goto_field, goto_value, hwnd = 0, newRecord = false)
{
permission = AccessPermissions(access, buildPath?:')
if false is permission
{
Alert("You do not have permission to access this option.", "Access",
hwnd, MB.ICONWARNING)
return
}
if not Suneido.Member?("AccessGoToCount"')
Suneido.AccessGoToCount = 0
if Suneido.AccessGoToCount >= 2
return
.logBookAccessGoTo(access, ':open')
++Suneido.AccessGoToCount
Dialog(hwnd,
Object(.wrapper, access.Eval(), readOnly: permission is 'readOnly',
goto_field: goto_field, goto_value: goto_value, newRecord: newRecord),
title: 'Access',
style: WS.SYSMENU | WS.CAPTION | WS.SIZEBOX | WS.TILEDWINDOW,
exStyle: WS_EX.DLGMODALFRAME, keep_size: access)
--Suneido.AccessGoToCount
.logBookAccessGoTo(access, ':close')
}

logBookAccessGoTo(access, text)
{
// do not attempt to BookLog access if there are no books currently open (app not running in a book)
if not Suneido.Member?("OpenBooks"') or Suneido.OpenBooks.Empty?()
return
path = AccessPermissions.BuildPath(access)
BookLog(path $ text)
}

wrapper: Controller
{
New(@args)
{
super(@args)
if (args.goto_value isnt false)
.AccessGoto(args.goto_field, args.goto_value)
ctrl = .FindControl('Access')
if args.readOnly is true and false isnt ctrl
ctrl.SetReadOnly(true)
if args.newRecord is true
{
if false isnt ctrl and ctrl.Method?('On_New')
ctrl.On_New()
}
}
Xmin: 782
Ymin: 535
Xstretch: 1
Ystretch: 1
}
}

 
 
Jeff Ferguson
Suneido Software