![]() ![]() When passing the properties in an input parameters struct, propertiesGUI automatically inspects each struct field and assigns a corresponding cell-editor with no description and a field label that reflects the field name. Naturally, this is only relevant in case of a modal dialog. parameters (output) is the resulting (possibly-updated) parameters struct.hPropsPane (output) is the handle of the generated properties panel widget, which can be customized to display field descriptions, toolbar, etc.If test_data is also empty, then a demo of several different data types will be used. If parameters is not specified, then the global test_data will be used. The fields are processed separately to determine their corresponding cell renderer and editor. parameters (input) is an optional struct or object with data fields.If missing or empty or 0, the table will be shown in a new modal dialog window otherwise it will be embedded in the parent container. ![]() hParent (input) is an optional handle of a parent GUI container (figure/uipanel/uitab) in which the properties table will appear.PropertiesGUI expects the following syntax: propertiesGUI is based on Levente Hunyadi’s articles here back in 2010, and on his “Property grid” utility on the File Exchange. PropertiesGUI, which can be downloaded from the Matlab File Exchange, presents a generic solution to this problem. In short, PropertyView is great unless you want to customize stuff, or do something slightly out-of-the-ordinary.Įnter propertiesGUI, the subject of today’s article. Boolean properties (true/false) always use a checkbox cell-renderer/editor, while we may wish to display a string (on/off) or combo-box instead. Last but not least, PropertyView does not enable users to easily modify the way that certain properties are presented. In the general case, we may wish to present a PropertyTable using row-specific renderers and editors, when we have such an un-inspectable object (struct, cell array etc.), or even for a dynamically-created table of properties that is not stored in any single object.Īnother limitation of PropertyView is that it immediately assigns updated property values to the inspected object, without allowing any sanity checks to be conducted on the new values, and without enabling the user to cancel property changes. Unfortunately, PropertyView cannot automatically retrospect Matlab structs, which is the reason that the built-in inspect function fails for such objects. For example, it is very common to store an application’s configuration properties in a struct (using Matlab objects is often impractical and unwarranted) - it would be very useful to present this configuration dynamically, without having to programmatically scan all struct fields and build a dedicated GUI table. We often need to present a non-object Matlab construct. PropertyView automatically extracts the inspected object’s properties and displays them using a corresponding renderer in the PropertyTable. I explained that uiinspect uses .PropertyView, which in turn uses JIDE’s PropertyTable. Something like Matlab’s inspect tool on steroids. Last week I presented a detailed explanation of the uiinspect utility, which displays a GUI listing all the properties, callbacks and internal methods of an inspected object.
0 Comments
Leave a Reply. |