Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Jijo Pappachan
  Where is Jijo Pappachan?
 Kerala
 India
 Jijo Pappachan
 Tags
Subject: RE: How to embeded code window into form
Thread ID: 310924 Message ID: 310952 # Views: 75 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Forms
Date: Monday, June 27, 2011 12:55:25 PM         
   


> Hi Experts,
> How to embedded code editor window into form?
> Bernad Bout has did it in his GDIPlusXPad application (unfortunately source code is not available)
> Please guide me to achieve this
>
>
>
> Jijo
> JUST THINK, THERE IS A WAY
> my blog:http://weblogs.foxite.com/jijo_pappachan/

try this code
publi yform
yform=newObject("asup")
yform.show
read events
return

DEFINE CLASS asup AS form
	Top = 26
	Left = 74
	Height = 390
	Width = 684
	ShowWindow = 0   &&1,2
	Caption = "Set a command window on a form for editing..."
	Name = "Form1"

	ADD OBJECT command1 AS commandbutton WITH ;
		Top = 348, ;
		Left = 300, ;
		Height = 27, ;
		Width = 84, ;
		Caption = "Process", ;
		Name = "Command1"

	ADD OBJECT ycmd AS commandbutton WITH ;
		Top = 0, ;
		Left = 7, ;
		Height = 37, ;
		Width = 661, ;
		FontSize = 14, ;
		Caption = "This is a commandbutton", ;
		ForeColor = RGB(255,0,0), ;
		BackColor = RGB(0,255,0), ;
		Name = "yCMD"

	PROCEDURE command1.Click
	define window yb  font "Arial",12 from 2,0 to 20,100 noclose nofloat grow   name mywin
with myWin
.top=thisform.yCmd.top+thisform.yCmd.height
.left=thisform.yCmd.left
.width=thisform.ycmd.width
.height=240
endwith

local myvar,lcfile
if !file("c:\dummy.prg")
text to myvar noshow
**************PRELIMINARIES*******************
the std  window of <modify command> is embed
on a form (showWindow=0,1,2).
the window is postionned as well on the form at any position.
the standard tools for coloring syntax...are conserved.
can modify grow option in the code...
NB:the saving dialog box appears when closing the form

YOUSFI Benameur monday june 27 2011

*********************************************
endtext
set safe off
strtofile(m.myvar,"c:\dummy.prg")
set safe on
endi

lcFile = "c:\dummy.prg"      && or any file: getfile("prg|txt")  
modi comm (lcfile)  window yb  in window (thisform.name)  nowait
	ENDPROC
	
    PROCEDURE DESTROY
    CLEA EVENTS
    ENDPROC

ENDDEFINE


NB:to avoid the save dialog box you have already a solution in this forum.

update

to have the scrollbars on the yb window you can add the option SYSTEM
define window yb  font "Arial",12 from 2,0 to 20,100 noclose nofloat grow system  name mywin

Regards
Yousfi Benameur

ENTIRE THREAD

How to embeded code window into form Posted by Jijo Pappachan @ 6/27/2011 10:27:15 AM
RE: How to embeded code window into form Posted by Mike Gagnon @ 6/27/2011 11:23:40 AM
RE: How to embeded code window into form Posted by Stefan Wuebbe @ 6/27/2011 12:09:23 PM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 6/27/2011 2:40:33 PM
RE: How to embeded code window into form Posted by Stefan Wuebbe @ 7/3/2011 10:32:45 AM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 7/4/2011 6:45:53 AM
RE: How to embeded code window into form Posted by Yousfi Benameur @ 6/27/2011 12:55:25 PM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 6/27/2011 2:34:02 PM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 6/27/2011 2:39:35 PM
RE: How to embeded code window into form Posted by Yousfi Benameur @ 6/27/2011 2:48:03 PM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 6/27/2011 2:55:40 PM
RE: How to embeded code window into form Posted by Bernard Bout @ 7/3/2011 5:00:34 AM
RE: How to embeded code window into form Posted by Jijo Pappachan @ 7/4/2011 6:44:46 AM