Hi,
In the textbox control, whether the event "On Change" is available only at definition time or it can be programatically changed later, like
FrmA.Text_1.OnChange := {|| some code }, if it can be changed what is the command ?
Case:
The textbox will be readonly when the database is opened in readonly mode and the contents can be changed if the database is opened in Read+write mode. The On change event will verify for this and accordingly save data.
if this cannot be done, what is the alternative ?, open two sets of same control ?, one in readonly mode and the other allowing save thru the on change event.
Kindly guide me.
Warm regards,
Jayadev
Textbox On change event, change event programatically later
Moderator: Rathinagiri
- esgici
- Posts: 4543
- Joined: Wed Jul 30, 2008 9:17 pm
- DBs Used: DBF
- Location: iskenderun / Turkiye
- Contact:
Re: Textbox On change event, change event programatically later
Hi Jayadev
AFAIK definition ( assigning a procedure / code block ) of all events in all controls is available only in design time, non changeable at run time.
You can release and re-define controls for changing events.
Regards
--
Esgici
AFAIK definition ( assigning a procedure / code block ) of all events in all controls is available only in design time, non changeable at run time.
You can release and re-define controls for changing events.
Regards
--
Esgici
Viva INTERNATIONAL HMG 

Re: Textbox On change event, change event programatically later
Hello Jayadev,
I like simple solution. Hope following event control sample will be helpful:-
And regarding read only controls I use following code snippet, where lAddmode and lEditmode are form level variables.
Following example also shows how to make a grid combo box readonly for HMG.
With best regards.
Sudip
I like simple solution. Hope following event control sample will be helpful:-
Code: Select all
#include "minigui.ch"
function main()
define window wmain at 0, 0 width 400 height 300 main
@ 10, 10 button cmdTest caption "Click Me" ;
on click showtest()
end window
wmain.center
wmain.activate
return nil
function showtest()
static x := .t.
if x
test1()
else
test2()
endif
x := !x
return nil
function test1()
msgbox("This is test 1 function")
return nil
function test2()
msgbox("This is test 2 function")
return nil
And regarding read only controls I use following code snippet, where lAddmode and lEditmode are form level variables.
Following example also shows how to make a grid combo box readonly for HMG.
Code: Select all
Static Function RefreshControl()
local lEditable
lEditable := lAddmode .or. lEditmode
frmCompound.Browse_1.Enabled := !lEditable
frmCompound.txtSearch.Enabled := !lEditable
frmCompound.txtCompoundNm.readonly := !lEditable
_HMG_SYSDATA [ 40 ] [ GetControlIndex ( 'grdCompoundrm' , 'frmCompound' ) ] [ 1 ] := lEditable
frmCompound.txtWastage.readonly := !lEditable
frmCompound.txtPlywt.readonly := !lEditable
frmCompound.cmdAdd.Enabled := !lEditable
frmCompound.cmdModify.Enabled := !lEditable
frmCompound.cmdDelete.Enabled := !lEditable
frmCompound.cmdSave.Enabled := lEditable
frmCompound.cmdCancel.Enabled := lEditable
RETURN nil
With best regards.
Sudip
With best regards,
Sudip
Sudip
Re: Textbox On change event, change event programatically later
Dear Esgici,
Many thanks for your reply.
Warm regards,
Jayadev
Many thanks for your reply.
Warm regards,
Jayadev
Re: Textbox On change event, change event programatically later
Dear Sudip,
Many thanks for your reply. In your first example, since the program branches out based to true or false, it implies the controls have to be defined twice, once for the true function and the other for the false function. I wanted to avoid that.
Your second example is very good and I already use that in my programs.
Warm regards,
Jayadev
Many thanks for your reply. In your first example, since the program branches out based to true or false, it implies the controls have to be defined twice, once for the true function and the other for the false function. I wanted to avoid that.
Your second example is very good and I already use that in my programs.
Warm regards,
Jayadev