Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.


If I have a piece of code like the following on the create event of a form, the editline gets a spin button. However, if I close the form and re-open the spin button is not displayed. It's functional but not visible, any ideas?

CtrlId = Win:".START"
Handle = Get_Property(CtrlId, "HANDLE")
rv = Send_Message("MAIN_TACTIC.OLE_SUBCLASS", "OLE.Subclass", Handle, CtrlId)
Convert "." to ";" in CtrlId
Call Set_Property("MAIN_TACTIC.OLE_SUBCLASS", "OLE.SpinButton[":CtrlId:"]", 1)


  • If it's multi-instance, perhaps the window name changing each time is the problem?
  • Kevin,

    Thanks for the quick response.

    No in fact on one window I have two spin controls. First time window is opened only one is displayed, the second-time window is displayed none are. The window has same name, I close the window and re-open it with the same code. Other windows that have only one spin control, the first window is opened it displays the second time it is not displayed.
  • Hmmm, sometimes tab order makes this behave oddly. What happens if you force the form to refresh in some way? Sometimes the button is there, but it hasn't redrawn.

    If that's not the issue, then I'll need code. I did a test on my end, and I'm able to get multiple spin controls running, and they all show no matter how many times I run the form.
  • Kevin,

    I am using 4.1.6 RC4 of your control.

    In one case the window (with two spin controls) is a stand-alone window, started using Start_Window with a parent of MAIN_TACTIC. The other window (with a single spin control) is a mdi child of MAIN_TACTIC. In both cases, the subclass control is on MAIN_TACTIC not on the window that has the issue.

    If this doesn't ring any bells, I'll put together a simple test example.
  • Since you have a global subclass control, can I presume that each control you are subclassing have different names?
  • The one form that has two spin controls, yes they have different names. The other does not use the same name as the other two.
  • Well, that was my last guess. I can't troubleshoot without seeing code.
  • OK let me put together simple example/
  • Not reproducible in a simple example. Let me see if I can figure out what code is causing the problem.
  • Nevermind, yes it is. Two Windows Test and Test1. How would you like me to send you an example?
  • An RDK would be fine if it's not too much trouble.
  • Kevin,

    Sent you an RDK, Test and Test1 forms. Run Test and click on the button, this opens Test1 from. Close Test1. Click on the button again. Now click within the editline that has a spin control.

    Thanks for the help.
  • I see what's going on. If you are going to use a global Subclass control, you need to Unsubclass the control in TEST1 during the CLOSE event. When you don't do that, then when you try to subclass a second time, the subclass control doesn't do it because it thinks the control has already been subclassed.

    While it's possible to re-code the Subclass method to just always subclass, it would break SRP FrameWorks. Moreover, when using a global Subclass control, it's good memory management to Unsubclass. There is not much overhead in putting a Subclass control on each form, so that's another way to go if you don't want to Unsubclass manually.
  • Kevin,

    Got it, many thanks.
  • Kevin,

    That doesn't seem to work.

    I added the code below to the close event. It appears to work but if on the second time opening the form you hover over the spin control it disappears.

    Declare Function Get_Property, Send_Message

    CtrlId = @Window:".START"
    Handle = Get_Property(CtrlId, "HANDLE")
    rv = Send_Message("TEST.OLE_SUBCLASS", "OLE.UnSubclass", Handle, CtrlId)
    RETURN 1

  • Kevin,

    Moving the Subclass control to TEST1 fixes the problem.

    Do not spend any more time on this, I'll fix it here.
  • For what it's worth, the reason the code above didn't work is because there is no Handle parameter to the Unsubclass method.
  • One last weird thing. The form that has two spin controls, one of the controls does not refresh when the form opens. Both have a value set in the create event, both are editlines, both are visible. However, one of the controls does not show the numeric value or spin controls until you move the mouse over the editline.

    Any ideas, ever seen anything like this?
  • This is sometimes related to tab order and when OI redraws controls during CREATE. Is your form invisible during CREATE?
  • Problem solved; another control was sitting on top of the actual control. Must have an unintended cut and paste.

    Thanks for the help, it's appreciated,
Sign In or Register to comment.