Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

Setting Field Border when Field has Focus

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Setting Field Border when Field has Focus

    I would like to be able to whizz through a Form and whenever the cursor lands on a field, the border changes to a different size and colour.
    I can do something similar using Flyover Effects, but that isn't what I am after.
    Also, I have about 180 fields to contend with over 3 Tabs just to make life interesting, so one field at a time would be a pain!
    Any Ideas?
    See our Hybrid Option here;
    https://hybridapps.example-software.com/


    We are the
    Department of Sunshine and Rainbows!

    Hope restored, faith renewed, spirits lifted!

    #2
    Re: Setting Field Border when Field has Focus

    Hi Ted,

    You need to xbasic code in the OnArrive and OnDepart events.

    Example of my form field dynamic changes:

    OnArrive:
    Code:
    this.font.bold=.T.
    this.fill.forecolor="pale yellow"
    OnDepart:
    Code:
    this.font.bold=.F.
    this.fill.forecolor="white"
    With the help of Dr Peter Wayne, I have this tool that will make the task a lot easier.
    I do caution you that I haven't used this tool in quite a while. I would test it on a test form before you
    alter the real form. Plus, I'm sure it could use some updating.


    Script: _Tool_TypeinFields
    Code:
    'Date Created: 08-Apr-2005 10:49:22 PM
    'Last Updated: 07-Oct-2017 10:00:16 AM
    'Created By  : Ron
    'Updated By  : Ron
    
    dim dlg_code as C
    dim event_code as C
    DIM global readonly1 as l
    DIM global readonly2 as l
    dim titlelength as N
    DIM global whichform as C
    'dim forms_all as C
    dim whatisthere as C
    'dim count as N
    dim kount as N
    dim kountblank as N
    dim frm as C
    dim frmchg as C
    dim vfield as C
    dim msg as C
    dim helptext as C
    dim runtime as n 
    dim sleeptime as n 
    
    runtime = .5
    sleeptime = runtime/20
    
    clearbuttonpushed = ""
    kount = 0
    kountblank = 0
    msg = " Progress"
    helptitle ="Change XBasic Code Help"
    helptext = <<%help%
    EDIT FORM:  Select the form you wish to work with.
    
    CLEAR SELECTED EVENTS:  Click on the check box, then select the Event to be cleared.
    
    WARNING!  ALL of the Code in every Type-In field of the Selected Event will be removed!
    You can clear only one Event at a time.
    
    READING AND WRITING CODE TO EVENTS:  You can work with either one event
    (1st or 2nd) or two events at the same time, (1st & 2nd).  The Read Only check box
    will read the Selected Event and display the content on the Type-In fields with code.
    If either one of the Read Only check boxes is checked, code should NOT be written to
    the any Event(s).
    
    Select the event(s) you wish to add code to.  Enter the code in the corresponding
    Xbasic code field.  Click "OK" and that code will be written to the selected Event
    for all the type-in fields on that form.
    	
    Existing code should not be overwritten.  
    
    NOTE:  If the EXACT text already exists, then the new code will NOT be added.  I do 
    believe it is case sensitive.
    
    WARRENTY and LIABILITY:  There isn't one and I assume no liability.  You are on your own.
    I did NOT test everything nor did I try everything that users can attempt.  It does do what I
    want it to do.  I recommend working with a duplicated form first.
    
    Ron Anusiewicz
    %help%
    'forms_all = a5.Form_Enum()
    'count = a5_array_from_string("a_forms",forms_all,local_variables())
    auto_list_whichform = a5.form_enum(2)
    temp_count = w_count(auto_list_whichform,crlf())
    
    DELETE a_whichform
    DIM a_whichform[temp_count] as c
    a_whichform.initialize(auto_list_whichform)
    a_whichform.sort("A")
    
    dim pct as N
    dim nchildren as N
    dim i as N
    dim j as N
    dim o as P
    dim f as P
    
    DIM SHARED clearevent as L
    DIM SHARED clearwhat as C
    DELETE a_clearwhat		
    DIM a_clearwhat[7] as c
    dim temp_list as c 
    temp_list = <<%list%
    OnArrive
    OnDepart
    OnChange
    CanArrive
    CanDepart
    OnFlyover
    OnFlyoverLeave
    %list%
    a_clearwhat.initialize(temp_list)
    
    text1 = "Select 1st Event:"
    text2 = "1st Event XBasic Code:"
    text3 = "Select 2nd Event:"
    text4 = "2nd Event XBasic Code:"
    text5 = "Read Only:"
    
    DIM global action1c as C
    DIM global action2c as C
    DIM global action1results as C
    DIM global action2results as C
    DIM SHARED varC_result as C
    DELETE a_action1
    DIM a_action1[4] as c
    dim temp_list as c 
    temp_list = <<%list%
    OnArrive
    OnChange
    CanArrive
    OnFlyover
    %list%
    a_action1.initialize(temp_list)
    
    DELETE a_action2		
    DIM a_action2[3] as c
    dim temp_list as c 
    temp_list = <<%list%
    OnDepart
    CanDepart
    OnFlyoverLeave
    %list%
    a_action2.initialize(temp_list)
    
    Tryagain:
    ok_button_label = "&OK"
    cancel_button_label = "&Cancel"
    help_button_label = "&Help"
    
    dlg_code = <<%dlg%
    {xmargin=6,6}
    {lf};
    {region}
    Edit Form:|{sp=26}Clear Selected Events:{sp=2}(20clearevent);;
    [.30,8whichform^#a_whichform]|{sp=28}[.20,8clearwhat^#a_clearwhat?clearevent];
    {endregion};
    {line=1,0};
    {lf};
    {region}
    <%T= Deselect 1st Events;%Deselect 1st Event!clearevents_button_click1?clearevent=.F.>
    {sp=26.7}
    <%T= Clear 1st Event Codes;%Empty 1st Event Code!clearcode_button_click1?clearevent=.F.>
    {endregion};
    {region}
    {text=20:text1?clearevent=.F.}|{sp=3}{text=23:text2?clearevent=.F.}{sp=5}
    {text=11:text5?clearevent=.F.}{sp=2}(10readonly1?clearevent=.F.);;
    [.45,5action1c^#a_action1?clearevent=.F.]| [%mw%.45,5action1results?clearevent=.F.];
    {endregion}
    {lf};
    {lf};
    {region}
    <%T= Deselect 2nd Events;%Deselect 2nd Event!clearevents_button_click2?clearevent=.F.>
    {sp=26}
    <%T= Clear 2nd Event Codes;%Empty 2nd Event Code!clearcode_button_click2?clearevent=.F.>
    {endregion};
    {region}
    {text=20:text3?clearevent=.F.}|{sp=3}{text=24:text4?clearevent=.F.}{sp=5}
    {text=11:text5?clearevent=.F.}{sp=1}(10readonly2?clearevent=.F.);;
    [.45,4action2c^#a_action2?clearevent=.F.]| [%mw%.45,5action2results?clearevent=.F.];
    {endregion};
    {line=1,0};
    {lf};
    {region}
    <*15,1.5=ok_button_label!OK> <15,1.5=cancel_button_label!CANCEL>{sp=30}
    <15,1.5=help_button_label!HELP>
    {endregion};
    %dlg%
    
    event_code = <<%code%
    if a_dlg_button = "clearevents_button_click1" then
    	a_dlg_button = "" 
    	button_xbasic = <<%code_string%
    	action1c=""
    	%code_string%
    	evaluate_template(button_xbasic)
    end if
    if a_dlg_button = "clearcode_button_click1" then
    	a_dlg_button = "" 
    	button_xbasic = <<%code_string%
    	action1results=""
    	%code_string%
    	evaluate_template(button_xbasic)
    end if
    if a_dlg_button = "clearevents_button_click2" then
    	a_dlg_button = "" 
    	button_xbasic = <<%code_string%
    	action2c=""
    	%code_string%
    	evaluate_template(button_xbasic)
    end if
    if a_dlg_button = "clearcode_button_click2" then
    	a_dlg_button = "" 
    	button_xbasic = <<%code_string%
    	action2results=""
    	%code_string%
    	evaluate_template(button_xbasic)
    end if
    %code%
    
    varC_result = ui_dlg_box(\
    "Change XBasic Code for Selected Events to all the Type-in Fields on the Selected Form",\
    dlg_code,event_code)
    
    if varC_result = "HELP" then
       ui_msg_box(" HELP",helptext)
       goto tryagain
    end if
    
    if varC_result <> "OK" then
       end
    end if
    
    if whichform = "" then
       ui_msg_box(" Warning","No Form Has Been Selected",ui_attention_symbol)
       goto tryagain
    end if
    
    if clearevent = .F. then
    	if action1c = "" .and. action2c = "" then
    	   if readonly1 = .T. .or. readonly2 = .T. then
    	      ui_msg_box(" Warning",\
    		   "No Events Have Been Selected For 'Read Only'",ui_attention_symbol)
    		   goto tryagain
    	   else
    	      ui_msg_box(" Warning",\
    		   "No Events Have Been Selected For 'Change'",ui_attention_symbol)
    		   goto tryagain
    	   end if
    	   
    	end if
    	if action1results="" .and. action2results="" .and.	readonly1=.F. .and. readonly2=.F. then
    		ui_msg_box(" Warning",\
    	   "No Event Code Has Been Entered, Read Only Has Not Been Selected",ui_attention_symbol)
    	goto tryagain
    	end if
    	if action1c <> "" .and. action1results="" .and.	readonly1=.F. then
    		ui_msg_box(" Warning",\
    	   "What Do You Want to do with the '"+action1c+"' event?",ui_attention_symbol)
    	goto tryagain
    	end if
    	if action2c <> "" .and. action2results="" .and.	readonly2=.F. then
    		ui_msg_box(" Warning",\
    	   "What Do You Want to do with the '"+action2c+"' event?",ui_attention_symbol)
    	goto tryagain
    	end if
    end if
    
    if clearevent = .T. then
    	if clearwhat = "" then
    	   ui_msg_box(" Warning",\
    	   "No Event Has Been Selected to Be Cleared",ui_attention_symbol)
    	   goto tryagain
    	end if
       'Displays a message box(style:'OK, Cancel Buttons', image: 'Stop symbol', id: 'clearall').
    	DIM SHARED  clearall_result as N
    	DIM SHARED  clearall_OK_Button as L 
    	DIM SHARED  clearall_CANCEL_Button as L 
    	clearall_OK_Button = .F.
    	clearall_CANCEL_Button = .F.
    	
    	title_var = " WARNING"
    	clearall_result=ui_msg_box(title_var,\
    	"You Have Selected To Clear ALL the '"+clearwhat+"' Events in The Form '"+whichform+"' ",\
    	UI_OK_CANCEL+ UI_SECOND_BUTTON_DEFAULT+ UI_STOP_SYMBOL)
    	'Test to see which button on the message box was pressed....
    	SELECT
    		CASE clearall_result = UI_OK_SELECTED
    			clearall_OK_Button= .t.
    		CASE clearall_result = UI_CANCEL_SELECTED
    			clearall_CANCEL_Button= .t.
    			END
    	END SELECT
    end if
    
    'a_forms.sort("a")
    ui_modeless_dlg_box(msg,<<%dlg%
    {sp=40}{text=3pct}%;
    {progress=80pct};
    {text=50,2:frmchg};
    <Close>;
    %dlg%,<<%code%
    if a_dlg_button="Close" then
       ui_modeless_dlg_close(msg)
       end
    end if
    %code%)
    'for i=1 to count
    	'frm = a_forms[i]
    	frm = whichform
    	'pct = int((i/count)*99)
    	'ui_modeless_dlg_refresh(msg)
    	on error goto errortrap
    	f=Form.load(frm)
    	f.Command("SYSTEM_DESIGN")
    	nchildren=f.Children()
    	for j=1 to nchildren
    		sleep(sleeptime)
    		pct = int((j/nchildren)*99)
    		ui_modeless_dlg_refresh(msg)
    		o=f.Child(j)
    		if o.class()="type-in field" then
    			vfield = ": " + f.Child(j).name()
    			frmchg = frm + vfield
    			kount = kount + 1
    		   	select
    		   		case readonly1 = .T. .and. clearevent = .F.
    		     	dim x as N
          			select
    	      			case action1c = "OnArrive"
        					whatisthere = o.code.OnArrive
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if
          			   case action1c = "OnChange"
        					whatisthere = o.code.OnChange
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if     			
    			      	case action1c = "CanArrive"
          					whatisthere = o.code.CanArrive
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if	      			
    			      	case action1c = "OnFlyover"
    	      				whatisthere = o.code.OnFlyover
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if
          		 	end select
          		END select
    			SELECT
          		case readonly2 = .T. .and. clearevent = .F.
       	      		select
       	          		case action2c = "OnDepart"
       						whatisthere = o.code.OnDepart
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if
          			   	case action2c = "CanDepart"
          					whatisthere = o.code.CanDepart
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),\
       						""+whatisthere+"")
       						end if		      			
    			      	case action2c = "OnFlyoverLeave"
    		      			whatisthere = o.code.OnFlyoverLeave
       						titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
       						x = 90 - titlelength
       						if whatisthere = "" then
       						   kountblank = kountblank + 1
       						else
       							ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),\
       						""+whatisthere+"")
         					end if
          		  		end select
          		  end select
          		  SELECT
          		  case clearevent = .T.
    		      		select
    		      		   case clearwhat = "OnArrive"
    		      		   			o.code.OnArrive=""
    		      		   	case clearwhat = "OnChange"
    		      		   			o.code.OnChange=""
    		      		   	case clearwhat = "CanArrive"
    		      		   			o.code.CanArrive=""
    		      		   	case clearwhat = "OnFlyover"
    		      		   			o.code.OnFlyover=""		
    		      		end select	
    		      case action1c = "OnArrive" .and. readonly1 = .F. .and. readonly2 = .F.
    	      			whatisthere = o.code.OnArrive
    	      			select
    	      			   	case action1results$whatisthere=.T.
    	      			   			'
    	      			   	case action1results$whatisthere=.F.
    	      			   			o.code.OnArrive=whatisthere+crlf()+action1results
    	      			end select
    		      case action1c = "OnChange" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.OnChange
    	      			select
    	      			   	case action1results$whatisthere=.T.
    	      			   			'
    	      			   	case action1results$whatisthere=.F.
    	      			   			o.code.OnChange=whatisthere+crlf()+action1results
    	      			end select
    		      	case action1c = "CanArrive" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.CanArrive
    	      			select
    	      			   	case action1results$whatisthere=.T.
    	      			   			'
    	      			   	case action1results$whatisthere=.F.
    	      			   			o.code.CanArrive=whatisthere+crlf()+action1results
    	      			end select
    		      	case action1c = "OnFlyover" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.OnFlyover
    	      			select
    	      			   	case action1results$whatisthere=.T.
    	      			   			'
    	      			   	case action1results$whatisthere=.F.
    	      			   			o.code.OnFlyover=whatisthere+crlf()+action1results
    	      			end select
    		   end select
    		   select
    		      case clearevent = .T.
    		      		select
    		      		   case clearwhat = "OnDepart"
    		      		   			o.code.OnDepart=""
    		      		   	case clearwhat = "CanDepart"
    		      		   			o.code.CanDepart=""
    		      		   	case clearwhat = "OnFlyoverLeave"
    		      		   			o.code.OnFlyoverLeave=""
    		      		end select	
    		      case action2c = "OnDepart" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.OnDepart
    	      			select
    	      			   	case action2results$whatisthere=.T.
    	      			   			'
    	      			   	case action2results$whatisthere=.F.
    	      			   			o.code.OnDepart=whatisthere+crlf()+action2results
    	      			end select
    		      case action2c = "CanDepart" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.CanDepart
    	      			select
    	      			   	case action2results$whatisthere=.T.
    	      			   			'
    	      			   	case action2results$whatisthere=.F.
    	      			   			o.code.CanDepart=whatisthere+crlf()+action2results
    	      			end select
    		      	case action2c = "OnFlyoverLeave" .and. readonly1 = .F. .and. readonly2 = .F.
    		      		whatisthere = o.code.OnFlyoverLeave
    	      			select
    	      			   	case action2results$whatisthere=.T.
    	      			   			'
    	      			   	case action2results$whatisthere=.F.
    	      			   			o.code.OnFlyoverLeave=whatisthere+crlf()+action2results
    	      			end select
    		   end select
    		end if
    	next j	
    	f.Command("FILE_SAVE")
    	f.Close()
    'next i	
    
    ui_modeless_dlg_close(msg)
    if readonly1 = .T. .or. readonly2 = .T. then
    	if kountblank > 0 then
    		ui_msg_box(" Success",\
    		""+kount+"  type-in fields were Examined and "+kountblank+" are Blank",\
    		ui_information_symbol)
    	else
    		ui_msg_box(" Success",""+kount+"  type-in fields were Examined",ui_information_symbol)
    	end if
    else
    	if clearevent = .T. then
    		ui_msg_box(" Success",""+kount+"  type-in fields were Cleared",ui_information_symbol)
    	else
    		ui_msg_box(" Success",""+kount+"  type-in fields were Changed",ui_information_symbol)
    	end if
    end if
    
    
    END
    
    errortrap:
    on error goto 0
    resume next
    Alpha 5 Version 11
    AA Build 2999, Build 4269, Current Build
    DBF's and MySql
    Desktop, Web on the Desktop and WEB

    Ron Anusiewicz

    Comment


      #3
      Re: Setting Field Border when Field has Focus

      Thanks Ron.
      The code looks complex, and I will try it out, but not with this client. It would be quicker to click through the fields and set the values. If it went rogue I would get shot.
      See our Hybrid Option here;
      https://hybridapps.example-software.com/


      We are the
      Department of Sunshine and Rainbows!

      Hope restored, faith renewed, spirits lifted!

      Comment


        #4
        Re: Setting Field Border when Field has Focus

        I took another look at this script. I went in an made a number of improvements.
        Again, run it on a test form first. But it will definitely save you time and energy.

        Code:
        'Date Created: 08-Apr-2005 10:49:22 PM
        'Last Updated: 07-Oct-2017 12:46:07 PM
        'Created By  : Ron
        'Updated By  : Ron
        
        dim dlg_code as C
        dim event_code as C
        DIM global readonly1 as l
        DIM global readonly2 as l
        dim titlelength as N
        DIM global whichform as C
        dim whatisthere as C
        dim kount as N
        dim kountblank as N
        dim frm as C
        dim frmchg as C
        dim vfield as C
        dim msg as C
        dim helptext as C
        dim runtime as n
        dim sleeptime as n
        
        runtime = .5
        sleeptime = runtime/20
        
        clearbuttonpushed = ""
        kount = 0
        kountblank = 0
        msg = " Progress"
        helptitle ="Change XBasic Code Help"
        helptext = <<%help%
        EDIT FORM:  Select the form you wish to work with.
        
        CLEAR SELECTED EVENTS:  Click on the check box, then select the Event to be cleared.
        
        WARNING!  ALL of the Code in every Type-In field of the Selected Event will be removed!  You can clear only one Event at a time.
        
        READING AND WRITING CODE TO EVENTS:  You can work with either one event (1st or 2nd) or two events at the same time, (1st & 2nd).  The Read Only check box will read the Selected Event and display the content on the Type-In fields with code.  If either one of the Read Only check boxes is checked, code should NOT be written to the any Event(s).
        
        Select the event(s) you wish to add code to.  Enter the code in the corresponding Xbasic code field.  Click "OK" and that code will be written to the selected Event for all the type-in fields on that form.  Existing code should not be overwritten.  
        
        NOTE:  If the EXACT text already exists, then the new code will NOT be added.  I do believe it is case sensitive.
        
        WARRANTY and LIABILITY:  There isn't one and I assume no liability.  You are on your own.  I did NOT test everything nor did I try everything that users can attempt.  It does do what I want it to do.  I recommend working with a duplicated form first.
        
        Ron Anusiewicz
        %help%
        
        auto_list_whichform = a5.form_enum(2)
        temp_count = w_count(auto_list_whichform,crlf())
        
        DELETE a_whichform
        DIM a_whichform[temp_count] as c
        a_whichform.initialize(auto_list_whichform)
        a_whichform.sort("A")
        
        dim pct as N
        dim nchildren as N
        dim i as N
        dim j as N
        dim o as P
        dim f as P
        
        DIM SHARED clearevent as L
        DIM SHARED clearwhat as C
        DELETE a_clearwhat
        DIM a_clearwhat[7] as c
        dim temp_list as c
        temp_list = <<%list%
        OnArrive
        OnDepart
        OnChange
        CanArrive
        CanDepart
        OnFlyover
        OnFlyoverLeave
        %list%
        a_clearwhat.initialize(temp_list)
        
        DIM XDialogStyle as P
        XDialogStyle.AccentColor = "Off White"
        XDialogStyle.Color = "Blue White"
        
        text1 = "Select 1st Event:"
        text2 = "1st Event XBasic Code:"
        text3 = "Select 2nd Event:"
        text4 = "2nd Event XBasic Code:"
        text5 = "Read Only:"
        
        DIM global action1c as C
        DIM global action2c as C
        DIM global action1results as C
        DIM global action2results as C
        DIM SHARED varC_result as C
        DELETE a_action1
        DIM a_action1[4] as c
        dim temp_list as c
        temp_list = <<%list%
        OnArrive
        OnChange
        CanArrive
        OnFlyover
        %list%
        a_action1.initialize(temp_list)
        
        DELETE a_action2
        DIM a_action2[3] as c
        dim temp_list as c
        temp_list = <<%list%
        OnDepart
        CanDepart
        OnFlyoverLeave
        %list%
        a_action2.initialize(temp_list)
        
        Tryagain:
        ok_button_label = "&OK"
        cancel_button_label = "&Cancel"
        help_button_label = "&Help"
        
        dlg_code = <<%dlg%
        {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
        {Windowstyle=Gradient Horizontal};
        
        {region}
        Edit Form:|{sp=10}Clear Selected Events:{sp=2}(20clearevent);;
        [.30,8whichform^#a_whichform]|{sp=10}[.20,8clearwhat^#a_clearwhat?clearevent];
        {endregion};;
        
        {line=1,0};
        {lf};
        
        {region}
        <%T= Deselect 1st Events;%Deselect 1st Event!clearevents_button_click1?clearevent=.F.>
        {sp=4}
        <%T= Clear 1st Event Codes;%Empty 1st Event Code!clearcode_button_click1?clearevent=.F.>
        {endregion};
        
        {region}
        {text=20:text1?clearevent=.F.}|{sp=3}{text=23:text2?clearevent=.F.}{sp=5}
        {text=11:text5?clearevent=.F.}{sp=2}(10readonly1?clearevent=.F.);;
        [.20,5action1c^#a_action1?clearevent=.F.]| [%mw%.45,5action1results?clearevent=.F.];
        {endregion};;;
        
        {region}
        <%T= Deselect 2nd Events;%Deselect 2nd Event!clearevents_button_click2?clearevent=.F.>
        {sp=4}
        <%T= Clear 2nd Event Codes;%Empty 2nd Event Code!clearcode_button_click2?clearevent=.F.>
        {endregion};
        
        {region}
        {text=20:text3?clearevent=.F.}|{sp=3}{text=24:text4?clearevent=.F.}{sp=5}
        {text=11:text5?clearevent=.F.}{sp=1}(10readonly2?clearevent=.F.);;
        [.20,4action2c^#a_action2?clearevent=.F.]| [%mw%.45,5action2results?clearevent=.F.];
        {endregion};;
        
        {line=1,0};;
        
        {region}
        <10,1.5=ok_button_label!OK?whichform <\> ""> <*10,1.5=cancel_button_label!CANCEL>{sp=30}
        <10,1.5=help_button_label!HELP>
        {endregion};
        %dlg%
        
        event_code = <<%code%
        if a_dlg_button = "clearevents_button_click1" then
        	a_dlg_button = "" 
        	button_xbasic = <<%code_string%
        	action1c=""
        	%code_string%
        	evaluate_template(button_xbasic)
        
        elseif a_dlg_button = "clearcode_button_click1" then
        	a_dlg_button = "" 
        	button_xbasic = <<%code_string%
        	action1results=""
        	%code_string%
        	evaluate_template(button_xbasic)
        
        elseif a_dlg_button = "clearevents_button_click2" then
        	a_dlg_button = "" 
        	button_xbasic = <<%code_string%
        	action2c=""
        	%code_string%
        	evaluate_template(button_xbasic)
        
        elseif a_dlg_button = "clearcode_button_click2" then
        	a_dlg_button = "" 
        	button_xbasic = <<%code_string%
        	action2results=""
        	%code_string%
        	evaluate_template(button_xbasic)
        end if
        %code%
        
        varC_result = ui_dlg_box(\
        "Change XBasic Code for Selected Events to all the Type-in Fields on the Selected Form",\
        dlg_code,event_code)
        
        if varC_result = "HELP" then
        	ui_msg_box(" HELP",helptext)
        	goto tryagain
        end if
        
        if varC_result <> "OK" then
        	end
        end if
        
        if whichform = "" then
        	ui_msg_box(" Warning","No Form Has Been Selected",ui_attention_symbol)
        	goto tryagain
        end if
        
        if clearevent = .F. then
        	if action1c = "" .and. action2c = "" then
        		if readonly1 = .T. .or. readonly2 = .T. then
        			ui_msg_box(" Warning",\
        			"No Events Have Been Selected For 'Read Only'",ui_attention_symbol)
        			goto tryagain
        		else
        			ui_msg_box(" Warning",\
        			"No Events Have Been Selected For 'Change'",ui_attention_symbol)
        			goto tryagain
        		end if
        		
        	elseif action1results="" .and. action2results="" .and.	readonly1=.F. .and. readonly2=.F. then
        		ui_msg_box(" Warning",\
        		"No Event Code Has Been Entered, Read Only Has Not Been Selected",ui_attention_symbol)
        		goto tryagain
        		
        	elseif action1c <> "" .and. action1results="" .and.	readonly1=.F. then
        		ui_msg_box(" Warning",\
        		"What Do You Want to do with the '"+action1c+"' event?",ui_attention_symbol)
        		goto tryagain
        		
        	elseif action2c <> "" .and. action2results="" .and.	readonly2=.F. then
        		ui_msg_box(" Warning",\
        		"What Do You Want to do with the '"+action2c+"' event?",ui_attention_symbol)
        		goto tryagain
        	end if
        end if
        
        if clearevent = .T. then
        	if clearwhat = "" then
        		ui_msg_box(" Warning",\
        		"No Event Has Been Selected to Be Cleared",ui_attention_symbol)
        		goto tryagain
        	end if
        	
        	DIM SHARED  clearall_result as N
        	DIM SHARED  clearall_CANCEL_Button as L
        	clearall_CANCEL_Button = .F.
        	
        	clearall_result=ui_msg_box(" WARNING",\
        	"You Have Selected To Clear ALL the '"+clearwhat+"' Events in The Form '"+whichform+"' ",\
        	UI_OK_CANCEL+ UI_SECOND_BUTTON_DEFAULT+ UI_STOP_SYMBOL)
        	
        	if	clearall_result = UI_CANCEL_SELECTED then
        	goto tryagain
        END IF
        end if
        
        'a_forms.sort("a")
        ui_modeless_dlg_box(msg,<<%dlg%
        {sp=40}{text=3pct}%;
        {progress=80pct};
        {text=50,2:frmchg};
        <Close>;
        %dlg%,<<%code%
        if a_dlg_button="Close" then
        ui_modeless_dlg_close(msg)
        end
        end if
        %code%)
        
        frm = whichform
        on error goto errortrap
        f=Form.load(frm)
        f.Command("SYSTEM_DESIGN")
        nchildren=f.Children()
        for j=1 to nchildren
        sleep(sleeptime)
        pct = int((j/nchildren)*99)
        ui_modeless_dlg_refresh(msg)
        o=f.Child(j)
        if o.class()="type-in field" then
        	vfield = ": " + f.Child(j).name()
        	frmchg = frm + vfield
        	kount = kount + 1
        	select
        		case readonly1 = .T. .and. clearevent = .F.
        			dim x as N
        			select
        			case action1c = "OnArrive"
        				whatisthere = o.code.OnArrive
        				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
        				x = 90 - titlelength
        				if whatisthere = "" then
        					kountblank = kountblank + 1
        				else
        					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        					if response = 2 then
        						goto exit_out
        					end if
        				end if
        			case action1c = "OnChange"
        				whatisthere = o.code.OnChange
        				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
        				x = 90 - titlelength
        				if whatisthere = "" then
        					kountblank = kountblank + 1
        				else
        					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        					if response = 2 then
        						goto exit_out
        					end if
        				end if
        			case action1c = "CanArrive"
        				whatisthere = o.code.CanArrive
        				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
        				x = 90 - titlelength
        				if whatisthere = "" then
        					kountblank = kountblank + 1
        				else
        					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        					if response = 2 then
        						goto exit_out
        					end if
        				end if
        			case action1c = "OnFlyover"
        				whatisthere = o.code.OnFlyover
        				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
        				x = 90 - titlelength
        				if whatisthere = "" then
        					kountblank = kountblank + 1
        				else
        					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        					if response = 2 then
        						goto exit_out
        					end if
        				end if
        		end select
        END select
        SELECT
        	case readonly2 = .T. .and. clearevent = .F.
        		select
        		case action2c = "OnDepart"
        			whatisthere = o.code.OnDepart
        			titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
        			x = 90 - titlelength
        			if whatisthere = "" then
        				kountblank = kountblank + 1
        			else
        				response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        				if response = 2 then
        					goto exit_out
        				end if
        			end if
        		case action2c = "CanDepart"
        			whatisthere = o.code.CanDepart
        			titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
        			x = 90 - titlelength
        			if whatisthere = "" then
        				kountblank = kountblank + 1
        			else
        				response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        				if response = 2 then
        					goto exit_out
        				end if
        			end if
        		case action2c = "OnFlyoverLeave"
        			whatisthere = o.code.OnFlyoverLeave
        			titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
        			x = 90 - titlelength
        			if whatisthere = "" then
        				kountblank = kountblank + 1
        			else
        				response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
        				if response = 2 then
        					goto exit_out
        				end if
        			end if
        	end select
        end select
        SELECT
        	case clearevent = .T.
        		select
        		case clearwhat = "OnArrive"
        			o.code.OnArrive=""
        		case clearwhat = "OnChange"
        			o.code.OnChange=""
        		case clearwhat = "CanArrive"
        			o.code.CanArrive=""
        		case clearwhat = "OnFlyover"
        			o.code.OnFlyover=""
        	end select
        	case action1c = "OnArrive" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.OnArrive
        		select
        		case action1results$whatisthere=.T.
        			'
        		case action1results$whatisthere=.F.
        			o.code.OnArrive=whatisthere+crlf()+action1results
        	end select
        	case action1c = "OnChange" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.OnChange
        		select
        		case action1results$whatisthere=.T.
        			'
        		case action1results$whatisthere=.F.
        			o.code.OnChange=whatisthere+crlf()+action1results
        	end select
        	case action1c = "CanArrive" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.CanArrive
        		select
        		case action1results$whatisthere=.T.
        			'
        		case action1results$whatisthere=.F.
        			o.code.CanArrive=whatisthere+crlf()+action1results
        	end select
        	case action1c = "OnFlyover" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.OnFlyover
        		select
        		case action1results$whatisthere=.T.
        			'
        		case action1results$whatisthere=.F.
        			o.code.OnFlyover=whatisthere+crlf()+action1results
        	end select
        end select
        
        select
        	case clearevent = .T.
        		select
        		case clearwhat = "OnDepart"
        			o.code.OnDepart=""
        		case clearwhat = "CanDepart"
        			o.code.CanDepart=""
        		case clearwhat = "OnFlyoverLeave"
        			o.code.OnFlyoverLeave=""
        	end select
        	case action2c = "OnDepart" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.OnDepart
        		select
        		case action2results$whatisthere=.T.
        			'
        		case action2results$whatisthere=.F.
        			o.code.OnDepart=whatisthere+crlf()+action2results
        	end select
        	case action2c = "CanDepart" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.CanDepart
        		select
        		case action2results$whatisthere=.T.
        			'
        		case action2results$whatisthere=.F.
        			o.code.CanDepart=whatisthere+crlf()+action2results
        	end select
        	case action2c = "OnFlyoverLeave" .and. readonly1 = .F. .and. readonly2 = .F.
        		whatisthere = o.code.OnFlyoverLeave
        		select
        		case action2results$whatisthere=.T.
        			'
        		case action2results$whatisthere=.F.
        			o.code.OnFlyoverLeave=whatisthere+crlf()+action2results
        	end select
        end select
        end if
        next j
        exit_out:
        f.Command("FILE_SAVE")
        f.Close()
        
        ui_modeless_dlg_close(msg)
        if readonly1 = .T. .or. readonly2 = .T. then
        	if kountblank > 0 then
        		ui_msg_box(" Success",\
        		""+kount+"  type-in fields were Examined and "+kountblank+" are Blank",\
        		ui_information_symbol)
        	else
        		ui_msg_box(" Success",""+kount+"  type-in fields were Examined",ui_information_symbol)
        	end if
        else
        	if clearevent = .T. then
        		ui_msg_box(" Success",""+kount+"  type-in fields were Cleared",ui_information_symbol)
        	else
        		ui_msg_box(" Success",""+kount+"  type-in fields were Changed",ui_information_symbol)
        	end if
        end if
        
        kount = 0
        kountblank = 0
        
        goto tryagain
        
        alldone:
        
        END
        
        errortrap:
        on error goto 0
        resume next
        Alpha 5 Version 11
        AA Build 2999, Build 4269, Current Build
        DBF's and MySql
        Desktop, Web on the Desktop and WEB

        Ron Anusiewicz

        Comment


          #5
          Re: Setting Field Border when Field has Focus

          I am very much obliged Ron. Thank you.
          See our Hybrid Option here;
          https://hybridapps.example-software.com/


          We are the
          Department of Sunshine and Rainbows!

          Hope restored, faith renewed, spirits lifted!

          Comment


            #6
            Re: Setting Field Border when Field has Focus

            Well it works like a charm Ron.
            Now what may I do in return?
            See our Hybrid Option here;
            https://hybridapps.example-software.com/


            We are the
            Department of Sunshine and Rainbows!

            Hope restored, faith renewed, spirits lifted!

            Comment


              #7
              Re: Setting Field Border when Field has Focus

              Thanks Ted,

              I did some more changes. I added the ability to remove selected text from an event.
              I did quite a bit of testing, but try it on a duplicate form until your certain it's working correctly.

              Code:
              'Date Created: 08-Apr-2005 10:49:22 PM
              'Last Updated: 08-Oct-2017 08:47:11 AM
              'Created By  : Ron
              'Updated By  : Ron
              
              dim dlg_code as C
              dim event_code as C
              DIM global readonly1 as l
              DIM global readonly2 as l
              dim titlelength as N
              DIM global whichform as C
              dim whatisthere as C
              dim kount as N
              dim kountblank as N
              dim frm as C
              dim frmchg as C
              dim vfield as C
              dim msg as C
              dim helptext as C
              dim runtime as n
              dim sleeptime as n
              dim global removetext1 as l
              dim global removetext2 as l
              
              runtime = .5
              sleeptime = runtime/20
              
              clearbuttonpushed = ""
              kount = 0
              kountblank = 0
              msg = " Progress"
              helptitle ="Change XBasic Code Help"
              helptext = <<%help%
              EDIT FORM:  Select the form you wish to work with.
              
              CLEAR SELECTED EVENTS:  Click on the check box, then select the Event to be cleared.
              
              WARNING!  ALL of the Code in every Type-In field of the Selected Event will be removed!  You can clear only one Event at a time.
              
              READING, WRITING and REMOVING CODE TO EVENTS:  You can work with either one event (1st or 2nd) or two events at the same time, (1st & 2nd).
              
              Read:  The Read Only check box will read the Selected Event and display the content on the Type-In fields with code.
              
              Add:  Select the event(s) you wish to add code to.  Enter the code in the corresponding Xbasic code field.  Click "OK" and that code will be written to the selected Event for all the type-in fields on that form.  Existing code should not be overwritten
              	
              NOTE:  If the EXACT text already exists, then the new code will NOT be added.  The search is not case sensitive.
              
              Remove Text:  Select the event you wish to remove code from.  Enter the code in the corresponding Xbasic code field.  Select Remove Text and Click "OK".  If the EXACT text is found in the selected event, that text will be removed.  The search is case sensitive.
              
              NOTE:  If either one of the Read Only check boxes is checked, code can NOT be written or removed from any Event.
              
              WARRANTY and LIABILITY:  There isn't one and I assume no liability.  You are on your own.  I did NOT test everything nor did I try everything that users can attempt.  It does do what I want it to do.  I recommend working with a duplicated form first.
              %help%
              
              auto_list_whichform = a5.form_enum(2)
              temp_count = w_count(auto_list_whichform,crlf())
              
              DELETE a_whichform
              DIM a_whichform[temp_count] as c
              a_whichform.initialize(auto_list_whichform)
              a_whichform.sort("A")
              
              dim pct as N
              dim nchildren as N
              dim i as N
              dim j as N
              dim o as P
              dim f as P
              
              DIM SHARED clearevent as L
              DIM SHARED clearwhat as C
              DELETE a_clearwhat
              DIM a_clearwhat[7] as c
              dim temp_list as c
              temp_list = <<%list%
              OnArrive
              OnDepart
              OnChange
              CanArrive
              CanDepart
              OnFlyover
              OnFlyoverLeave
              %list%
              a_clearwhat.initialize(temp_list)
              
              DIM XDialogStyle as P
              XDialogStyle.AccentColor = "Off White"
              XDialogStyle.Color = "Blue White"
              
              text1 = "Select 1st Event:"
              text2 = "1st Event XBasic Code:"
              text3 = "Select 2nd Event:"
              text4 = "2nd Event XBasic Code:"
              text5 = "Read Only:"
              text6 = "Remove Text:"
              
              DIM global action1c as C
              DIM global action2c as C
              DIM global action1results as C
              DIM global action2results as C
              DIM SHARED varC_result as C
              DELETE a_action1
              DIM a_action1[4] as c
              dim temp_list as c
              temp_list = <<%list%
              OnArrive
              OnChange
              CanArrive
              OnFlyover
              %list%
              a_action1.initialize(temp_list)
              
              DELETE a_action2
              DIM a_action2[3] as c
              dim temp_list as c
              temp_list = <<%list%
              OnDepart
              CanDepart
              OnFlyoverLeave
              %list%
              a_action2.initialize(temp_list)
              
              Tryagain:
              ok_button_label = "&OK"
              cancel_button_label = "&Cancel"
              help_button_label = "&Help"
              
              dlg_code = <<%dlg%
              {units=F}{font=Calibri,12}{xmargin=4,4}{ysize=.3}
              {Windowstyle=Gradient Horizontal};
              
              {region}
              Edit Form:|{sp=10}Clear Selected Event:{sp=2}(20clearevent);;
              [.30,8whichform^#a_whichform]|{sp=10}[.20,8clearwhat^#a_clearwhat?clearevent];
              {endregion};;
              
              {line=1,0};
              {lf};
              
              {region}
              <%T= Deselect 1st Events;%Deselect 1st Event!clearevents_button_click1?clearevent=.F.>
              {sp=4}
              <%T= Clear 1st Event Codes;%Empty 1st Event Code!clearcode_button_click1?clearevent=.F.>
              {endregion};
              
              {region}
              {text=20:text1?clearevent=.F.}|{sp=3}{text=23:text2?clearevent=.F.}{sp=4}
              {text=11:text6?clearevent=.F. .and. readonly1=.f.} (removetext1?clearevent=.F. .and. readonly1=.f.)    {text=10:text5?clearevent=.F. .and. removetext1=.f.}(10readonly1?clearevent=.F. .and. removetext1=.f.);;
              [.20,5action1c^#a_action1?clearevent=.F.]| [%mw%.60,5action1results?clearevent=.F.];
              {endregion};;;
              
              {region}
              <%T= Deselect 2nd Events;%Deselect 2nd Event!clearevents_button_click2?clearevent=.F.>
              {sp=4}
              <%T= Clear 2nd Event Codes;%Empty 2nd Event Code!clearcode_button_click2?clearevent=.F.>
              {endregion};
              
              {region}
              {text=20:text3?clearevent=.F.}|{sp=3}{text=24:text4?clearevent=.F.}{sp=4}
              {text=11:text6?clearevent=.F. .and. readonly2=.f.} (removetext2?clearevent=.F. .and. readonly2=.f.)   {text=10:text5?clearevent=.F. .and. removetext2=.f.}(10readonly2?clearevent=.F. .and. removetext2=.f.);;
              [.20,4action2c^#a_action2?clearevent=.F.]| [%mw%.60,5action2results?clearevent=.F.];
              {endregion};;
              
              {line=1,0};;
              
              {region}
              <10,1.5=ok_button_label!OK?whichform <\> ""> <*10,1.5=cancel_button_label!CANCEL>{sp=45}
              <10,1.5=help_button_label!HELP>
              {endregion};
              %dlg%
              
              event_code = <<%code%
              if a_dlg_button = "clearevents_button_click1" then
              	a_dlg_button = "" 
              	button_xbasic = <<%code_string%
              	action1c=""
              	%code_string%
              	evaluate_template(button_xbasic)
              
              elseif a_dlg_button = "clearcode_button_click1" then
              	a_dlg_button = "" 
              	button_xbasic = <<%code_string%
              	action1results=""
              	%code_string%
              	evaluate_template(button_xbasic)
              
              elseif a_dlg_button = "clearevents_button_click2" then
              	a_dlg_button = "" 
              	button_xbasic = <<%code_string%
              	action2c=""
              	%code_string%
              	evaluate_template(button_xbasic)
              
              elseif a_dlg_button = "clearcode_button_click2" then
              	a_dlg_button = "" 
              	button_xbasic = <<%code_string%
              	action2results=""
              	%code_string%
              	evaluate_template(button_xbasic)
              end if
              %code%
              
              varC_result = ui_dlg_box(\
              "Change XBasic Code for Selected Events to all the Type-in Fields on the Selected Form",\
              dlg_code,event_code)
              
              if varC_result = "HELP" then
              	ui_msg_box(" HELP",helptext)
              	goto tryagain
              end if
              
              if varC_result <> "OK" then
              	end
              end if
              
              if whichform = "" then
              	ui_msg_box(" Warning","No Form Has Been Selected",ui_attention_symbol)
              	goto tryagain
              end if
              
              if clearevent = .F. then
              	if action1c = "" .and. action2c = "" then
              		if readonly1 = .T. .or. readonly2 = .T. then
              			ui_msg_box(" Warning",\
              			"No Events Have Been Selected For 'Read Only'",ui_attention_symbol)
              			goto tryagain
              		else
              			ui_msg_box(" Warning",\
              			"No Events Have Been Selected For 'Change'",ui_attention_symbol)
              			goto tryagain
              		end if
              		
              	elseif action1results="" .and. action2results="" .and.	readonly1=.F. .and. readonly2=.F. then
              		ui_msg_box(" Warning",\
              		"No Event Code Has Been Entered, Read Only Has Not Been Selected",ui_attention_symbol)
              		goto tryagain
              		
              	elseif action1c <> "" .and. action1results="" .and.	readonly1=.F. then
              		ui_msg_box(" Warning",\
              		"What Do You Want to do with the '"+action1c+"' event?",ui_attention_symbol)
              		goto tryagain
              		
              	elseif action2c <> "" .and. action2results="" .and.	readonly2=.F. then
              		ui_msg_box(" Warning",\
              		"What Do You Want to do with the '"+action2c+"' event?",ui_attention_symbol)
              		goto tryagain
              	end if
              end if
              
              if clearevent = .T. then
              	if clearwhat = "" then
              		ui_msg_box(" Warning",\
              		"No Event Has Been Selected to Be Cleared",ui_attention_symbol)
              		goto tryagain
              	end if
              	
              	DIM SHARED  clearall_result as N
              	DIM SHARED  clearall_CANCEL_Button as L
              	clearall_CANCEL_Button = .F.
              	
              	clearall_result=ui_msg_box(" WARNING",\
              	"You Have Selected To Clear ALL the '"+clearwhat+"' Events in The Form '"+whichform+"' ",\
              	UI_OK_CANCEL+ UI_SECOND_BUTTON_DEFAULT+ UI_STOP_SYMBOL)
              	
              	if	clearall_result = UI_CANCEL_SELECTED then
              	goto tryagain
              END IF
              end if
              
              'a_forms.sort("a")
              ui_modeless_dlg_box(msg,<<%dlg%
              {sp=40}{text=3pct}%;
              {progress=80pct};
              {text=50,2:frmchg};
              <Close>;
              %dlg%,<<%code%
              if a_dlg_button="Close" then
              ui_modeless_dlg_close(msg)
              end
              end if
              %code%)
              
              'debug(1)	'***************************************************)
              
              frm = whichform
              on error goto errortrap
              f=Form.load(frm)
              f.Command("SYSTEM_DESIGN")
              nchildren=f.Children()
              for j=1 to nchildren
              sleep(sleeptime)
              pct = int((j/nchildren)*99)
              ui_modeless_dlg_refresh(msg)
              ui_yield()
              o=f.Child(j)
              if o.class()="type-in field" then
              	vfield = ": " + f.Child(j).name()
              	frmchg = frm + vfield
              	kount = kount + 1
              	
              	'handle read 1st event
              	select
              		case readonly1 = .T. .and. clearevent = .F.
              			dim x as N
              			select
              			case action1c = "OnArrive"
              				whatisthere = o.code.OnArrive
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              			case action1c = "OnChange"
              				whatisthere = o.code.OnChange
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              			case action1c = "CanArrive"
              				whatisthere = o.code.CanArrive
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              			case action1c = "OnFlyover"
              				whatisthere = o.code.OnFlyover
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action1c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action1c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              		end select
              	END select
              
              	'handle read 2nd event
              	SELECT
              		case readonly2 = .T. .and. clearevent = .F.
              			select
              			case action2c = "OnDepart"
              				whatisthere = o.code.OnDepart
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              			case action2c = "CanDepart"
              				whatisthere = o.code.CanDepart
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              			case action2c = "OnFlyoverLeave"
              				whatisthere = o.code.OnFlyoverLeave
              				titlelength = len(alltrim(frmchg)) + len(alltrim(action2c))
              				x = 90 - titlelength
              				if whatisthere = "" then
              					kountblank = kountblank + 1
              				else
              					response = ui_msg_box(frmchg+"  field"+space(x)+action2c+"  xBasic"+space(1),""+whatisthere+"",UI_OK_CANCEL)
              					if response = 2 then
              						goto exit_out
              					end if
              				end if
              		end select
              	end select
              	
              	SELECT
              		'handle clear 1st event
              		case clearevent = .T.
              			select
              			case clearwhat = "OnArrive"
              				o.code.OnArrive=""
              			case clearwhat = "OnChange"
              				o.code.OnChange=""
              			case clearwhat = "CanArrive"
              				o.code.CanArrive=""
              			case clearwhat = "OnFlyover"
              				o.code.OnFlyover=""
              		end select
              		
              		'handle write 1st event.  if the text is not found, add the text
              		case action1c = "OnArrive" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .F.
              			whatisthere = o.code.OnArrive
              			if action1results$whatisthere=.F. then
              				o.code.OnArrive=whatisthere+crlf()+action1results
              			end if
              		case action1c = "OnChange" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .F.
              			whatisthere = o.code.OnChange
              			if action1results$whatisthere=.F. then
              				o.code.OnChange=whatisthere+crlf()+action1results
              			end if
              		case action1c = "CanArrive" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .F.
              			whatisthere = o.code.CanArrive
              			if action1results$whatisthere=.F. then
              				o.code.CanArrive=whatisthere+crlf()+action1results
              			end if
              		case action1c = "OnFlyover" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .F.
              			whatisthere = o.code.OnFlyover
              			if action1results$whatisthere=.F. then
              				o.code.OnFlyover=whatisthere+crlf()+action1results
              			end if
              
              		'handle remove text 1st event, if the text is found, remove it.  
              		case action1c = "OnArrive" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .T.
              			whatisthere = o.code.OnArrive
              			if action1results$whatisthere=.T. then
              				o.code.OnArrive=strtran(o.code.OnArrive,action1results,"",1)		
              			end if
              		case action1c = "OnChange" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .T.
              			whatisthere = o.code.OnChange
              			if action1results$whatisthere=.T. then
              				o.code.OnChange=strtran(o.code.OnChange,action1results,"",1)		
              			end if
              		case action1c = "CanArrive" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .T.
              			whatisthere = o.code.CanArrive
              			if action1results$whatisthere=.T. then
              				o.code.CanArrive=strtran(o.code.CanArrive,action1results,"",1)		
              			end if
              		case action1c = "OnFlyover" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext1 = .T.
              			whatisthere = o.code.OnFlyover
              			if action1results$whatisthere=.T. then
              				o.code.OnFlyover=strtran(o.code.OnFlyover,action1results,"",1)		
              			end if
              	end select
              
              	select
              		'handle clear 2nd event
              		case clearevent = .T.
              			select
              			case clearwhat = "OnDepart"
              				o.code.OnDepart=""
              			case clearwhat = "CanDepart"
              				o.code.CanDepart=""
              			case clearwhat = "OnFlyoverLeave"
              				o.code.OnFlyoverLeave=""
              		end select
              		
              		'handle write 2nd event.  if the text is not found, add the text
              		case action2c = "OnDepart" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .F.
              			whatisthere = o.code.OnDepart
              			if action2results$whatisthere=.F. then
              				o.code.OnDepart=whatisthere+crlf()+action2results
              			end if
              		case action2c = "CanDepart" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .F.
              			whatisthere = o.code.CanDepart
              			if action2results$whatisthere=.F. then
              				o.code.CanDepart=whatisthere+crlf()+action2results
              			end if
              		case action2c = "OnFlyoverLeave" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .F.
              			whatisthere = o.code.OnFlyoverLeave
              			if action2results$whatisthere=.F. then
              				o.code.OnFlyoverLeave=whatisthere+crlf()+action2results
              			end if
              
              		'handle remove text 2nd event, if the text is found, remove it.  
              		case action2c = "OnDepart" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .T.
              			whatisthere = o.code.OnDepart
              			if action2results$whatisthere=.T. then
              				o.code.OnDepart=strtran(o.code.OnDepart,action2results,"",1)		
              			end if
              		case action2c = "CanDepart" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .T.
              			whatisthere = o.code.CanDepart
              			if action2results$whatisthere=.T. then
              				o.code.CanDepart=strtran(o.code.CanDepart,action2results,"",1)		
              			end if
              		case action2c = "OnFlyoverLeave" .and. readonly1 = .F. .and. readonly2 = .F. .and. removetext2 = .T.
              			whatisthere = o.code.OnFlyoverLeave
              			if action2results$whatisthere=.T. then
              				o.code.OnFlyoverLeave=strtran(o.code.OnFlyoverLeave,action2results,"",1)		
              			end if
              		end select
              	end if
              next j
              exit_out:
              f.Command("FILE_SAVE")
              f.Close()
              
              ui_modeless_dlg_close(msg)
              if readonly1 = .T. .or. readonly2 = .T. then
              	if kountblank > 0 then
              		ui_msg_box(" Success",\
              		""+kount+"  type-in fields were Examined and "+kountblank+" are Blank",\
              		ui_information_symbol)
              	elseif kount = 0 then
              		ui_msg_box(" Oops","The form '" +whichform+ "' doesn't have any type-in fields",ui_information_symbol)
              	elseif kount > 0 then	
              		ui_msg_box(" Success",""+kount+"  type-in fields were Examined",ui_information_symbol)
              	end if
              else
              	if clearevent = .T. then
              		ui_msg_box(" Success",""+kount+"  type-in fields were Cleared",ui_information_symbol)
              	else
              		ui_msg_box(" Success",""+kount+"  type-in fields were Changed",ui_information_symbol)
              	end if
              end if
              
              kount = 0
              kountblank = 0
              
              goto tryagain
              
              alldone:
              
              END
              
              errortrap:
              on error goto 0
              resume next
              Alpha 5 Version 11
              AA Build 2999, Build 4269, Current Build
              DBF's and MySql
              Desktop, Web on the Desktop and WEB

              Ron Anusiewicz

              Comment


                #8
                Re: Setting Field Border when Field has Focus

                Thanks Ron.
                See our Hybrid Option here;
                https://hybridapps.example-software.com/


                We are the
                Department of Sunshine and Rainbows!

                Hope restored, faith renewed, spirits lifted!

                Comment

                Working...
                X