Author Topic: Program closed by toolbar button  (Read 2001 times)

0 Members and 1 Guest are viewing this topic.

Aurel

  • Guest
Program closed by toolbar button
« on: February 07, 2013, 02:51:45 AM »
Charles...
Do you can confirm that program is closed by simply clicking toolbar button in
AsciEdit example.?
program have a bug   ::)
when you click button Save As on start then program is closed.
I simply can't figured why that heapend   ???

Code: [Select]
'save file
Sub doSave
INT hsize=0

dir=""
char tx[32768]
string ext=".o2bas"

filter="All Files (*.*)" + Chr(0) + "*.*" + Chr(0) + "Oxygen Files (*.o2bas)" + Chr(0) + "*.o2bas" + Chr(0)
title="Save File... "
hwnd=0
fName = FileDialog(dir,filter,title,0,1,"o2bas")
fName=fName+ext
'print fname
hsize = SendMessage hsci, SCI_GETTEXTLENGTH, 0, 0
If hsize=0 then return
SendMessage hsci,SCI_GETTEXT,hsize,tx
PutFile fName,tx
Return
End sub

Aurel

  • Guest
Re: Program closed by toolbar button
« Reply #1 on: February 07, 2013, 04:37:01 AM »
Charles..
I just download latest OxygenBasic (inProgress) and try to use oxygen.dll
from this package and..
I have recieve to many errors in my older files.
Is this dll tested ?

Aurel

  • Guest
Re: Program closed by toolbar button
« Reply #2 on: February 07, 2013, 07:35:08 AM »
Grr...i hate this things...
I think that i am find what is wrong...
char tx[32768] cose this troubles.. >:(
so new subroutine look like this:
Code: [Select]
SUB doSave
INT hsize=0

dir=""
'char tx[32768]
string tx
string ext=".o2bas"

filter="All Files (*.*)" + Chr(0) + "*.*" + Chr(0) + "Oxygen Files (*.o2bas)" + Chr(0) + "*.o2bas" + Chr(0)
title="Save File... "
hwnd=0
fName = FileDialog(dir,filter,title,0,1,"")
fName=fName+ext
print fname
hsize = SendMessage hsci, SCI_GETTEXTLENGTH, 0, 0
If hsize=0 then return
SendMessage hsci,SCI_GETTEXT,hsize,strptr tx
PutFile fName,tx

END SUB

I'm still not sure why extension string is not recognized properly  ???
in Save subroutine ,maybe is problem in standard 3 chars instead of  .o2bas (5) .

Aurel

  • Guest
Re: Program closed by toolbar button
« Reply #3 on: February 07, 2013, 08:27:16 AM »
Hmm it seems that not work on other ways then using char,but this time I
add char tx[32768] as global variable and looks that work ok... ::)
Code: [Select]
'save file
SUB doSave
INT hsize=0

dir=""
'char tx[32768]
string ext=".o2bas"

filter="All Files (*.*)" + Chr(0) + "*.*" + Chr(0) + "Oxygen Files (*.o2bas)" + Chr(0) + "*.o2bas" + Chr(0)
title="Save File... "
hwnd=0
fName = FileDialog(dir,filter,title,0,1,"o2bas")
fName=fName+ext
If fName="" then Return
'print fname
hsize = SendMessage hsci, SCI_GETTEXTLENGTH, 0, 0
SendMessage hsci,SCI_GETTEXT,hsize+1,tx
PutFile fName,tx

END SUB