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

Stuffing the Default for a control

Hi all,

Hopefully this is something very simple; but I haven't been able to find how to do this. When I land on a given control (like an editline), I want to be able to stuff the "default" for that control at Gotfocus. I can stuff Defprop, Text, Invalue, etc., but that doesn't quite get me what I need. I'm talking about what you find in the default in the properties dialog for a control (i.e. DATETIME or a literal, etc.)

The DEFAULT property is associated with the current @Window and is the control (button) that clicks when you press Enter. DEFPROP is the content of the control. Is there a property that contains the default for a given control? How/can that be manipulated?

Thanks in advance!

Michael

Comments

  • I think you are looking for the custom function default:


  • Exactly.. How/ can I put something there programagically?
  • FUNCNAME is just a place holder. You put your own function name there (without the return variable syntax). You can pass arguments but they must be enclosed within quotes.

    We have a function called WIN_DEF that we use. It programmatically checks to see what control has focus and then dynamically calls our "default" logic as needed. This eliminates the need to have a custom function for each control.
  • And if it wasn't obvious, your "return value" from your function is what gets put into the control.
  • Thank you sir
  • Hi Don,

    I have the Default function as you specified, and I know how to call it from an Editline, for example. But is there a way to call from a Combobox? The defaulting functionality doesn't seem to be the same; and when I try to put the function call in the custom function default, it won't save the change.

    Why do I always find these gems? lol

    Thanks!

    Michael
  • Comboboxes are a different type of control so the default is meant to identify which item in the dropdown list of items should be the default. OpenInsight 8.0.3 introduced a way to dynamically populate your comboboxes from one of four sources:
    • < File, fieldname >
    • < File, ID:id >
    • < File, ID:id Field:fieldno >
    • Program to call, returning an @vm delimited list
  • I'm actually replacing the normal dropdown process. But I still need to provide a default when the user lands on the combobox, the same way we do with an editline.

    If I populate the List programmatically, how can I programmatically say which will show as a default?
  • Generally speaking you would use the TEXT property. What kind of combobox is this?
  • But if I stuff the TEXT property, the text is filled in. I'm trying to duplicate the default handling ala Arev. It fills in when you press Enter. Doesn't the OI Editline default work the same way?

    I could replace the combo box with an editline and an option button but I'll have to rewrite some code.

    The combo box is defined as dropdown, not simple or dropdown list.
  • But if I stuff the TEXT property, the text is filled in. I'm trying to duplicate the default handling ala Arev. It fills in when you press Enter. Doesn't the OI Editline default work the same way?
    No, that is not how the OI edit line default works nor is it how Windows default logic works in general. Defaults in Windows apps pre-fill when you enter the control and pressing Enter just leaves that data in place unless the user clears or changes it first.

    You seemed to be acquainted with the edit line default logic in your original post when it comes to common things such as dates, times, etc. Thus, it never occurred to me that you were trying to emulate AREV (which is a mistake, IMO).
    I could replace the combo box with an editline and an option button but I'll have to rewrite some code.
    As always, right tool for the right job. However, given that I don't really know the full requirements for this project I can't advise if this is the best way to go.
    The combo box is defined as dropdown, not simple or dropdown list.
    Thanks. However, given the other news this is somewhat moot now.
  • I should say, the Arev style is how my client Wants it to work.. lol

    Thanks for your help sir
  • ¯\_(ツ)_/¯
Sign In or Register to comment.