DMsGuild Classic
  1. #1

    Bug with CoreRPG 3.3.12 Column List onInit()

    Hi,

    Been having a problem in the Mongoose Traveller ruleset, that some of the 'Padlocks' are appearing on Reference Sheets as Red (correct) yet '_iedit' buttons attached to lists on the sheet are appearing when they shouldn't.

    In the CoreRPG code 'common/scripts/column_list.lua' at the top on the onInit(), I've modified it to include debug comments.

    Code:
    function onInit()
        Debug.console('CoreRPG here')
        if isReadOnly() then
            self.update(true);
        else
            local node = getDatabaseNode();
            if not node or node.isReadOnly() then
                Debug.console('CoreRPG here3')
                self.update(true);
                Debug.console('CoreRPG here3.1')
            end
        end
        Debug.console('CoreRPG here4')
    end
    
    function isEmpty()
        return (getWindowCount() == 0);
    end
    
    function update(bReadOnly, bForceHide)
        Debug.console('CoreRPG update', bReadOnly)
        Debug.console('CoreRPG update', bForceHide)
    Note that `update` is called with 'True' as the first argument.

    However on inspecting the value of `bReadOnly` parameter in the 'update' function, it's been received as 'nil'.

    Runtime Notice: Host session started
    Runtime Notice: s'CoreRPG here'
    Runtime Notice: s'CoreRPG here3'
    Runtime Notice: s'CoreRPG update' | nil
    Runtime Notice: s'CoreRPG update' | nil
    Runtime Notice: s'CoreRPG here3.1'
    Runtime Notice: s'CoreRPG here4'
    If the `self` is removed from the onInit() calls to 'update' then the behaviour is correct.

    Cheers,
    MBM

  2. #2
    I just modified by CoreRPG column_list.lua file to the following code; and got the attached messages when opening a record that used list_column template.

    Code:
    function onInit()
    	Debug.chat("ON INIT START");
    	if isReadOnly() then
    		self.update(true);
    	else
    		local node = getDatabaseNode();
    		if not node or node.isReadOnly() then
    			Debug.chat("IS READ ONLY INIT 1");
    			self.update(true);
    			Debug.chat("IS READ ONLY INIT 2");
    		end
    	end
    	Debug.chat("ON INIT END");
    end
    
    function isEmpty()
    	return (getWindowCount() == 0);
    end
    
    function update(bReadOnly, bForceHide)
    	Debug.chat("UPDATE", bReadOnly, bForceHide);
    Just a reminder that "self" is a reference to the top-level layer of any templates; so if you are layering a script on top of this template either within the control definition or via another template. Then, the top-level layer update function will be called by self.update; not the one in the current file. If no update function is defined in higher layers, then it will fall through to this update call.

    Regards,
    JPG
    Attached Images Attached Images

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
DMsGuild

Log in

Log in