1. #1

    where does the control's update(bReadOnly, bForceHide) end up?

    I was clicking through the refdoc page trying to find where this call ends up. I looked up self in Lua docs but it was describing the syntactic sugar of implied arguments and some other uses - none of these seem to apply here.

    So I suspect it is simply some global reference to the context, a this of sorts. Going by that, it is calling update() on the string_columnh which goes to basic_string etc.
    But where do I find it? My trail ended at "stringcontrol" and the wiki does not refer to update on it or it's "parents", neither could I find it in the CoreRPG code.

    I am not sure how to trace this... in C++/Java I'd run a blasted debugger

    I was just trying to verify what "self" means here (think I did - refers to the enclosing windowless and the lookup is to get at one of its controls - but now that think know that, can't find what update() does or even a comment on it.)


    From npc_main.lua in 2E but is basically the same in 5E.
    Code:
    function updateControl(sControl, bReadOnly, bForceHide)
      if not self[sControl] then
        return false;
      end
      
      return self[sControl].update(bReadOnly, bForceHide);
    end
    Last edited by Varsuuk; January 21st, 2020 at 04:43.

  2. #2
    The update function is part of several templates included in CoreRPG layer. (They are used heavily in column_ft, column_list, column_number, column_string templates; as well as update being a common name used in many templates and scripts)

    Regards,
    JPG

  3. #3
    Quote Originally Posted by Moon Wizard View Post
    The update function is part of several templates included in CoreRPG layer. (They are used heavily in column_ft, column_list, column_number, column_string templates; as well as update being a common name used in many templates and scripts)

    Regards,
    JPG
    AH perfect, there it is - I missed how it got there. Now that know the end source, I am sure I will see the obvious connection back up the chain that I overlooked. thanks!


    Now I can read to understand what the result bool means as well as how readonly and forcehide flags interact to get result.
    Code:
    function update(bReadOnly, bForceHide)
    	local bLocalShow;
    	if bForceHide then
    		bLocalShow = false;
    	else
    		bLocalShow = true;
    		if bReadOnly and not nohide and isEmpty() then
    			bLocalShow = false;
    		end
    	end
    	
    	setReadOnly(bReadOnly);
    	setVisible(bLocalShow);
    	
    	local sLabel = getName() .. "_label";
    	if window[sLabel] then
    		window[sLabel].setVisible(bLocalShow);
    	end
    	if separator then
    		if window[separator[1]] then
    			window[separator[1]].setVisible(bLocalShow);
    		end
    	end
    	
    	if self.onVisUpdate then
    		self.onVisUpdate(bLocalShow, bReadOnly);
    	end
    	
    	return bLocalShow;
    end

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
  •  

Log in

Log in