Forum Discussion

Robert_Pallot's avatar
Robert_Pallot
New Contributor
15 years ago

Problem accessing buttons on a TcxButtonEdit control

Hi Folks,

Using TestComplete version 8.50.618.7 with DevExpress version 55 controls and having difficulty with the TcxButtonEdit control.

I'm unable to access anything useful beyond the TcxButtonEdit.Properties.Buttons level, although the help on this site suggests I should be able to. The Object Spy is only able to resolve the following properties:



ClassName: TcxEditButtons

InstancePtr: 229216160

VCLClass: TcxEditButtons



I'm attempting to count the number of (visible) buttons on this control. Any hints/pointers as to how to achieve this would be most welcome.



Regards,

Robert Pallot

8 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    I'm not incredibly familiar with DevExpress controls.  However, according to the help:




    Supported Versions


    Supported component version: Developer Express XtraEditors ver. 7.2, 9.1.2,
    9.3, 10.1, 2010.1.4.





    I wonder if your problem is that you're using an unsupported version?  Of course, I could be wrong, but it seems that, if the control version is not supported, you might not see everything.  Double check this help topic just to make sure of version matches.



    http://smartbear.com/support/viewarticle/11165/

  • leahey's avatar
    leahey
    Occasional Contributor
    Hey Robert and Robert, just to confuse things, I'll jump in here...



    Robert (Martin) I believe that Robert is using the DevEx VCL controls (Delphi) rather than the .net control (which are prefixed with "Xtra").



    It's been a while since I automated a VCL/DevEx app, but as I recall, you have to actually activate the editor (an internal visible object that doesn't exist until you're editing the value of the control) in order to automate some of those properties.



    Try this: record a script against the UI in question, interacting with the editor in some ways... click on it, type in it, etc. Then compare the generated script with what you see in the TestComplete object browser for the UI when you're not interacting with it. I'll bet you'll see references in the script to an object that doesn't exist in the browser. That'll be the dynamically created editor object that you'll want to interact with.
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    That would do it... similar to the TVirtualStringTree grid that i'm familiar with where, when you want to edit a particular cell, the edit control doesn't exist until you actually click on it.



    Yeah, then a FindAllChildren or other such thing based upon that edit class would return an empty set since the edit classes don't exist until they are actually utilized.



    So... between the two Roberts, have we been able to answer the question of the one Robert?  This could get strange, quickly... ;)
  • leahey's avatar
    leahey
    Occasional Contributor
    "TeamAQA... with TWICE the Robert of other teams!"
  • Thanks Robert and Robert,

    Apart from the distinct feeling I've been talking to myself, what you say makes sense. I'll give it a go when I get in to work.



    cheers,

    Robert
  • Hi again folks,

    A bit more information, and in keeping with what seems to be the general theme of this thread, Robert has answered his own question ;-D


    • Robert L is correct in his assumption that I'm using the DevExpress VCL for Delphi controls. I suspect the help relating to the DevExpress controls on this site are for the .NET versions. There are significant differences in the scoping rules between VCL and .NET which would explain my confusion.

    • I tried the idea of recording a script against the UI, but have come up against the same problem: I can identify the edit control, its internal editor and the Properties.Buttons property on the control, I cannot see any properties that are declared on the Buttons collection.

    • While Robert M's comment about the various internal editors in the DevExpress suite not being instantiated until they are used is correct, it is not really relevant to this situation because the Buttons collection does exist for the life of the TcxButtonEdit control.

    • A bit more investigation has revealed that the TcxButtons class doesn't publish any of its properties - all the ones I'm interested in are public. So I guess I'm flogging a dead horse here.

    • Some lateral thinking has revealed a path I might follow however; I can compare the widths of the control and its inner edit control. The difference will indicate how many buttons are showing.




    Thanks for your input

    Robert (Pallot)
  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    Aha!  That's it..



    By default, Delphi applications only give you access to published properties.  If, however, you want access to public, private and protected properties, you can still do so but you would need to compile your application with debug information.



    See the following article.



    http://smartbear.com/support/viewarticle/13169/
  • leahey's avatar
    leahey
    Occasional Contributor
    Robert(s), have a look at this:



    I threw a TcxButtonEdit on a form and opened it up in the TC Object Browser. The "Buttons" property is a property of the non-visual "Properties" property of the DX editors. To get to it, you have to know your way around the Object Browser, and here's your crash course:



    - Make sure that, in the object browser, you're in Advanced View: with the cxButtonEdit selected in the Object Tree, look under the Properties tab on the right side of the Object Browser. If it says "Basic view", click on the link that says "View more members (Advanced view)".

    - In the Search edit, on the far right, start typing "Properties". The browser will filter down until you should see the Properties property under the RTTI group with a value of "[Object]". Click the ellipsis button of that editor to drill into the object.

    - Now we're into the non-visual "Properties" object which has the Buttons object.



    However, now I feel I've led you astray: I can see the Buttons object, but it's basically nothing but a pointer; no propeties. I can't experiment any farther right now since I've got a meeting. More later...