StackOverflowMATLABchat / mlapptools

MATLAB class containing methods for programmatic uifigure modification
http://undocumentedmatlab.com/blog/customizing-uifigures-part-2
MIT License
25 stars 11 forks source link

Basic uitable support #4

Closed Dev-iL closed 6 years ago

Dev-iL commented 6 years ago

Added some methods for manipulating uitables, and an accompanying demo app. Also included some minor refactoring of method names to follow Java conventions (internal functions, so no change to API).

NOTE: As of the creation of the PR, the markdown documentation wasn’t updated, so please see \Demo\TableDemo.m for a demonstration of the new functionality.

Dev-iL commented 6 years ago

Things to do before the PR is merged (comments by @altmany):

  1. README - fix the list of methods at the top (aboutDojo is listed at the end os setStyle, not in a separate line)
  2. README - add explanation and usage example for aboutDojo()
  3. README - add explanation and usage example for getWidgetInfo() and also list it at the top (list of public methods)
  4. README - fontWeight() - clarify that 'lighter' is also accepted, and that the actual visible effect depends on the availability in the font-face that is used
  5. mlapptools - make getWidgetInfo() accept a specific control handle (not just a uifigure handle) and return only the information relevant for this specific control
  6. mlapptools - make getWebWindow() and getWebElements() public
  7. mlapptools - fontweight() has a bug: needs to call mlapptools.validateFontWeight(), not .validatefontweight()
  8. mlapptools - make QUERY_TIMEOUT public (or at least have a public setter method)
  9. TableDemo - in ButtonPushed(), don't loop over ...:44 but rather over ...:size(w,1) - it is indeed 22 for R2017x, but may well change in R2018x, so better keep it generic...
sco1 commented 6 years ago

RE: 8 on your list, since we're using this as an Abstract class I'm not sure we'll be able to do this. I'd prefer not having to instantiate the class just to have a settable timeiout, so it may have to be done using a global or an external settings file that can be parsed.

altmany commented 6 years ago

re 8, you could have a setTimeout(hFig,value) function that would _setappdata(hFig,'QUERYTIMEOUT',value) and then whenever you want to check for the timeout you could do something like:

timeout = getappdata(hFig,'QUERY_TIMEOUT');
if isempty(timeout), timeout = mlapptools.QUERY_TIMEOUT; end
while true && (toc < timeout)
   ...
Dev-iL commented 6 years ago

@sco1 @altmany I have added some more commits that address most of the suggestions above.

Thoughts / comments?

Dev-iL commented 6 years ago

Implemented 5 as explained in my previous comment. Tested all code examples manually. I think it's ready to merge now. Will wait for comments until the end of the day before merging.

sco1 commented 6 years ago

Haven't had a chance to play with the newest functionality but it still looks OK to me. I'm assuming you guys have looked at it pretty thoroughly so I'm confident that it works as desired.

Until MATLAB renders external README documents I'd prefer to keep at least a framework of the inline documentation in place so folks have at least something useful show up with doc/help. I'd still defer to the README for more in-depth information.

sco1 commented 6 years ago

Also, once this PR is merged I'll go back through and tag releases as requested...wherever it was requested.

altmany commented 6 years ago

Waiting for your merge to post the followup article on UndocumentedMatlab.com

altmany commented 6 years ago

https://undocumentedmatlab.com/blog/customizing-uifigures-part-3

altmany commented 6 years ago

Thanks for the great work @sco1 & @Dev-iL - very high-quality code, and nifty research indeed into the Dojo underworld :-)

I'm 100% certain that this will get MathWorks' attention, and for a very good reason - they should have included this functionality in their code ages ago.

sco1 commented 6 years ago

@altmany Fingers crossed! More than a few head scratchers with the new UI engine, as much as I love it.

I dream of a day when we can get documented methods for things like centering text without having to muck through the underlying graphics engine. Though there will always be a soft spot in my heart for the many hours spent with findjobj :relaxed: