Normal Topic Focus (Read 876 times)
SpencerWulwick
Senior Member
Members
*****
Offline



Posts: 677
Location: Wilton Manors, Florida
Joined: Jan 16th, 2005
Focus
Mar 15th, 2005 at 3:30am
Print Post Print Post  
Is there any way that you can reference the layout element that has 'focus' in a programming statement.   In other words, I want to enter programming based on which layout element the cursor is currently in.
  

- Spencer

    ** Practice random kindness & senseless acts of beauty!
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: Focus
Reply #1 - Mar 15th, 2005 at 6:36am
Print Post Print Post  
Spencer,
I know what you are trying to do.  You are bent upon having only one Command button for Dial and use it for six different phonenumbers, dialing the phonenumber where the curser is just before you click the Dial command button. Perfect !!!

Use of ThisElement which is available in version 1.1 reference the value of the element in focus.

Initialize the variable for phonenumber in the Globalcode:

GlobalCode:

var vPhonenumber as String

Subroutine DialPhone ( )
var VSuccess as Int
var vAreacode as string = "630"   //Area code
var vName as String = Name    //if firstname and last name change accordingly
var vPath as String = "C:\sesame\utilities\"  //path for dial.exe file


vPhonenumber = @num (vPhonenumber)

If @len (vPhonenumber) = 10 then
     {
           If @left (vPhonenumber, 3) = vAreacode then
           {      
                 vPhonenumber = @Right (vPhonenumber, 7)
           }
           Else
           {
                 vphonenumber = 1 + vPhonenumber
           }
     }

vsuccess = @Shell(@Chr(34) + vPath + "dial.exe" + @Chr(34) + " " + vPhonenumber  + " [" + vName +"]")  

If not vSuccess = 0 then
     {
           @msgbox ("Problem!!! Dialer did not work.", "", "")

     }
end subroutine

==========================


Dialer Command Button
on ElementEntry event

DialPhone ( )

=====================

In  each of the six phone elements you have the following code goes in ElementEntry Event:

vPhonenumber = ThisElement

========================

Substitute the path for dial.exe file, area code and Name in subroutine in globalcode as per your setup.

Just put the cursor on the phone element that you want to dial and press the Dial button.

As such, this discussion can go in the Phone Dialer Topic.
« Last Edit: Mar 15th, 2005 at 10:53pm by Bharat_Naik »  
Back to top
 
IP Logged