PB作记事本太难了!做了一天都弄不出来

PB做记事本太难了!!做了一天都弄不出来
本帖最后由 pale42 于 2013-08-04 19:01:01 编辑
我的记事本一共有新建,打开,保存,另存为,退出 5个功能全部都做不完整和做不出来。

第一个问题
打开文件显示不了在多行编辑框上,代码如下:
String docname,named
String ls_txt
Integer value
   value=GetFileOpenName("開啟文檔",docname,named,"DOC",&
   "文檔文件(*.TXT),*.TXT,"&
   +"Doc 文檔(*.DOC),*.DOC")
IF value=1 THEN FileOpen(docname,LineMode!,Write!,Shared!,replace!)
ls_txt =  mle_1.text
FileWrite(value,ls_txt)

第二个问题
另存为功能保存不了,代码如下:
String docname,named
Integer value,li_ret
Boolean ld_exist
  value=GetFileSaveName("保存文檔",&
  docname,named,"DOC",&
  "文檔文件(*.TXT),*.TXT,"+&
  "Doc 文檔(*.DOC),*.DOC")
   IF value=1 THEN FileOpen(docname)
   ld_exist=FileExists(docname)
IF ld_exist  THEN li_ret = MessageBox("保存",&
   "按OK按鈕覆蓋所選文件"+docname,&
   Question!,YesNo!)

第三个问题:
多行编辑框不知道怎么设置跟随窗口缩小放大。

第四个问题:
怎么在新建跟退出有内容的文本的时候提示用户保存与否?

我是一位刚学PB的超级菜鸟。网上又找不到其他资料了。PB不知道为什么很难在网上找资料学习。现在就感谢这个论坛能让我多学点。希望能看见5个功能完整的代码,让我弄清楚点。先谢谢大神们了。求打救! 
------解决方案--------------------

forward
global type w_main from window
end type
type cb_5 from commandbutton within w_main
end type
type cb_saveas from commandbutton within w_main
end type
type cb_save from commandbutton within w_main
end type
type cb_open from commandbutton within w_main
end type
type cb_new from commandbutton within w_main
end type
type mle_1 from multilineedit within w_main
end type
end forward

global type w_main from window
integer width = 3200
integer height = 1828
boolean titlebar = true
string title = "Untitled"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
cb_5 cb_5
cb_saveas cb_saveas
cb_save cb_save
cb_open cb_open
cb_new cb_new
mle_1 mle_1
end type
global w_main w_main

type variables
string is_filename = ''
boolean ib_modified = false
end variables

on w_main.create
this.cb_5=create cb_5
this.cb_saveas=create cb_saveas
this.cb_save=create cb_save
this.cb_open=create cb_open
this.cb_new=create cb_new
this.mle_1=create mle_1
this.Control[]={this.cb_5,&
this.cb_saveas,&
this.cb_save,&
this.cb_open,&
this.cb_new,&
this.mle_1}
end on

on w_main.destroy
destroy(this.cb_5)
destroy(this.cb_saveas)
destroy(this.cb_save)
destroy(this.cb_open)
destroy(this.cb_new)
destroy(this.mle_1)
end on

event open;this.title = '新建文本文件'
end event

event closequery;if ib_modified then
if messagebox('提示', '数据已经修改,是否要保存?', Question!, YesNo!, 1) = 1 then
if cb_save.event clicked() = 1 then
//
else
return 1
end if
end if
end if
end event

type cb_5 from commandbutton within w_main
integer x = 1522
integer y = 28
integer width = 352
integer height = 92
integer taborder = 20
integer textsize = -10
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "退出"
end type

event clicked;close(parent)
end event

type cb_saveas from commandbutton within w_main
integer x = 1157
integer y = 28
integer width = 352
integer height = 92
integer taborder = 20
integer textsize = -10
integer weight = 400
fontcharset fontcharset = gb2312charset!
fontpitch fontpitch = variable!
string facename = "宋体"
string text = "另存"
end type

event clicked;String docname,named
Integer li_value
Boolean ld_exist
li_value = GetFileSaveName("保存文件", docname, named, "DOC",&
   "文本文件(*.txt),*.txt, "&
   + "所有文件(*.*),*.*")
IF li_value = 1 THEN
//
else
return 0
end if

IF FileExists(docname) THEN
if MessageBox("提示", "文件已经存在,是否要覆盖?", Question!, YesNo!, 2) = 1 then
//