Hi,
Have program that allows user to enter and edit text in a multiline textbox. To make more eligant, add a graphic control with a bitmap.
Problem is if I just disable graphic control, and add a control redraw,
when editing text, old text is not erased? Only way I can edit text is to
kill graphic control. I want user to be able to edit over a bitmap background. Is there any way to do this?
Here is sample(not executable code):
Example 1 code kills graphic control, so user can edit text without screen flicker after
every keypress.
Example 1 code:
Example 2 code only Disables graphic control, so user can edit text, but screen flickers after
every keypress. Without control redraw, text is smeared or not erased, when editing on bitmap?
Example 2 code:
Have program that allows user to enter and edit text in a multiline textbox. To make more eligant, add a graphic control with a bitmap.
Problem is if I just disable graphic control, and add a control redraw,
when editing text, old text is not erased? Only way I can edit text is to
kill graphic control. I want user to be able to edit over a bitmap background. Is there any way to do this?
Here is sample(not executable code):
Example 1 code kills graphic control, so user can edit text without screen flicker after
every keypress.
Example 1 code:
Code:
SUB MAINDIALOG CONTROL ADD LABEL, hDlg, %IDL_COM1, "C", 13, 76, 5, 9, %SS_LEFT CONTROL ADD LABEL, hDlg, %IDL_COM2, "omments", 18, 76, 31, 9, %SS_LEFT ' Background for below text box %IDT_TEXT, this code must be above (control add textbox) CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "", 53, 61, 325, 229 GRAPHIC ATTACH hDlg, %IDG_BACKGRD ', REDRAW GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229) CONTROL ADD TEXTBOX, hDlg, %IDT_TEXT, "", 58, 74 ,315, 212, _ %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _ OR %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2& ' TO SEE BITMAP AS BACKGROUND END FUNCTION CALLBACK FUNCTION MAINDIALOG CALLBACK ELSEIF CBCTL = %IDT_TEXT THEN '104 THEN CBID = 104 ' Graphic control is killed in Sub Editor, so user can enter and erase text in %IDT_TEXT FUNCTION = 1 KEYP = 0 ELSEIF CBCTL = %IDG_BACKGRD THEN ' User left mouse clicks in Comments box ' See %WM_COMMAND, where Sub Editor is called, to disable buttons CONTROL DISABLE CBHNDL, %IDG_BACKGRD ' For Editing CONTROL REDRAW CBHNDL, %IDT_TEXT CONTROL SET FOCUS CBHNDL, %IDT_TEXT FUNCTION = 1 END IF ' IF CBCT = ... SUB Editor ' Disabled in CASE %IDG_BACKGRD, so we can kill CONTROL KILL hDlg, %IDG_BACKGRD CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), RGB(255,128,0) END SUB
every keypress. Without control redraw, text is smeared or not erased, when editing on bitmap?
Example 2 code:
Code:
SUB MAINDIALOG CONTROL ADD LABEL, hDlg, %IDL_COM1, "C", 13, 76, 5, 9, %SS_LEFT CONTROL ADD LABEL, hDlg, %IDL_COM2, "omments", 18, 76, 31, 9, %SS_LEFT ' Background for below text box %IDT_TEXT, this code must be above (control add textbox) CONTROL ADD GRAPHIC, hDlg, %IDG_BACKGRD, "", 53, 61, 325, 229 GRAPHIC ATTACH hDlg, %IDG_BACKGRD ', REDRAW GRAPHIC RENDER FullCurrentPath+"\BITMAPS\GoldCream325180.bmp", (0,0)-(325, 229) CONTROL ADD TEXTBOX, hDlg, %IDT_TEXT, "", 58, 74 ,315, 212, _ %ES_NOHIDESEL OR %ES_AUTOVSCROLL OR %ES_MULTILINE OR %ES_LEFT _ OR %ES_WANTRETURN OR %WS_TABSTOP OR %WS_CHILD OR %WS_VISIBLE, %WS_EX_TRANSPARENT CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), -2& ' TO SEE BITMAP AS BACKGROUND END FUNCTION CALLBACK FUNCTION MAINDIALOG CALLBACK ELSEIF CBCTL = %IDT_TEXT THEN '104 THEN CBID = 104 ' Must use CONTROL REDRAW, FOR EDITING, but screen flickers, 1-15-2008 CONTROL REDRAW CBHNDL, %IDT_TEXT ' Needed if control %IDG_BACKGRD is not killed, flickers FUNCTION = 1 KEYP = 0 ELSEIF CBCTL = %IDG_BACKGRD THEN ' User left mouse clicks in Comments box ' See %WM_COMMAND, where Sub Editor is called, to disable buttons CONTROL DISABLE CBHNDL, %IDG_BACKGRD ' For Editing CONTROL REDRAW CBHNDL, %IDT_TEXT CONTROL SET FOCUS CBHNDL, %IDT_TEXT FUNCTION = 1 END IF ' IF CBCT = ... SUB Editor ' Disabled in CASE %IDG_BACKGRD, so we can kill rem CONTROL KILL hDlg, %IDG_BACKGRD rem CONTROL SET COLOR hDlg, %IDT_TEXT, RGB(128,64,0), RGB(255,128,0) END SUB
Comment