Get a Jumpstart with our Sample Apps
Results 1 to 8 of 8

Thread: User Defined Smart Fields and Browses

  1. #1
    "Certified" Alphaholic
    Real Name
    Tom Baker
    Join Date
    Jun 2006
    Location
    Near Cherry Hill, NJ
    Posts
    1,296

    Default User Defined Smart Fields and Browses

    I am try to test the User Defined Smart Field in browses

    The what's new in V9 describes how to set the udsm as follows

    To define a smart-field, right click on the column and select Properties. On the 'Setup' tab, check the 'User Defined Smart Field' checkbox.
    In testing I tried to do this. For the form (see first thumbnail) when you click on the set up tab of properties at the bottom of the genie is the checkbox for the user defined smart field.

    For a browse (both named and embedded) when you click on a column and then right click properties then set up tab - there is no check box for user defined smart fields.

    Am I missing something?

    Tom Baker

  2. #2
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,164

    Default Re: User Defined Smart Fields and Browses

    I cannot find a link to What's new in Version 9 anymore where this feature is explained. However it still exists in the legacy documentation - but of course without pictures.

    I wanted to add the short time picker to a column in an embedded browse for a character field, and that field type option was not available - even though the time() function returns a character value. There is a focus_button property for each of the columns but it is not exposed in the properties editor. So this is how to do it:

    In the OnInit event for the form set the icon for the button using this format browse_name:column_name.focus_button = "image_name"

    Ex: browse1:SIGN_IN.focus_button = "$$control.clock"

    Right click on the embedded browse and create a function in the Browse/Events (if you have other events already defined then the selection will be Browse/Events/Events)

    use your own column name instead of SIGN_IN - and substituting ' this.value ' for sign_in.value ought to work as well and make it more generic since you are in the active field.
    Code:
    FUNCTION SIGN_IN_FocusButtonClick AS V ( )              
    if sign_in.value = "" then
    		sign_in.value = time("0h:0m AM",now())
    	else
    		dim vtime as Y
    		vtime = ctot(ui_get_short_time("Sign In Time",time("0h:0m AM",now() )))
    		sign_in.value = time("0h:0m AM",vtime)		
    	end if
    
    	topparent.commit()
    	sign_in.refresh()
    END FUNCTION
    When the field is active the clock appears and if the field is blank, the first click inserts the current time (quick method); then a 2nd click on the button will popup the short time picker for editing.

    The nice part of using a smart field here instead of adding an unbound browse button, is that it only appears if the field is active instead of showing all the time.

    Hope somebody else finds this useful because the option ought to be in the v12 desktop!
    Last edited by MoGrace; 07-17-2017 at 04:29 PM.
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,662

    Default Re: User Defined Smart Fields and Browses

    http://www.alphasoftware.com/documen...es/Index/Alpha Five V9.xml

    but no pictures. Supposed to link to a video.
    There can be only one.

  4. #4
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,164

    Default Re: User Defined Smart Fields and Browses

    I got the 404 page for that link
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  5. #5
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    24,662

    Default Re: User Defined Smart Fields and Browses

    There can be only one.

  6. #6
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,164

    Default Re: User Defined Smart Fields and Browses

    Well, I did send in a complaint that this info was not there earlier
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  7. #7
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,164

    Default Re: User Defined Smart Fields and Browses

    Having watched both videos, neither of those methods Selwyn used will blank the value if the user selects the cancel button. IOW there is no way to trap the result and thus the field will always get updated. Too bad, I guess I can use another button to clear the field...
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

  8. #8
    "Certified" Alphaholic MoGrace's Avatar
    Real Name
    Robin
    Join Date
    Mar 2006
    Location
    Los Angeles
    Posts
    3,164

    Default Re: User Defined Smart Fields and Browses

    A rather crucial error above kept this from working
    Code:
    FUNCTION SIGN_IN_FocusButtonClick AS V ( )              
    if browse1:sign_in.value = "" then
    		browse1:sign_in.value = time("0h:0m AM",now())
    	else
    		dim vtime as Y
    		vtime = ctot(ui_get_short_time("Sign In Time",time("0h:0m AM",now() )))
    		browse1:sign_in.value = time("0h:0m AM",vtime)		
    	end if
    
    	topparent.commit()
    	browse1:sign_in.refresh()
    END FUNCTION
    Since this subject has little info available and the other posts have no links anymore, thought I should update this. Also 'this.value' will not work, since this is not the same type of event that a _buttonclick or _titleclick event would require. You do not include 'this.Set_Viewport_row(row)' or use the same parameters in this function, and instead address the column field as above.
    Last edited by MoGrace; 11-09-2017 at 04:41 PM. Reason: fix my error
    Robin

    Discernment is not needed in things that differ, but in those things that appear to be the same. - Miles Sanford

Similar Threads

  1. user defined functions
    By dik_coleman in forum Alpha Five Version 7
    Replies: 10
    Last Post: 12-24-2005, 11:42 AM
  2. User defined functions on WAS
    By Karen Snyder in forum Web Application Server v6
    Replies: 2
    Last Post: 09-29-2005, 09:44 PM
  3. User-defined Fields?
    By WesOlfert in forum Alpha Five Version 5
    Replies: 13
    Last Post: 03-01-2005, 11:25 AM
  4. user-defined functions
    By Tim Stephens in forum Alpha Five Version 5
    Replies: 3
    Last Post: 12-05-2002, 06:33 AM
  5. looking at a user defined function
    By David Longcor in forum Alpha Five Version 4
    Replies: 3
    Last Post: 01-29-2001, 08:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •