IonicWind Software

Aurora Compiler => Coding Help - Aurora 101 => Topic started by: nico on July 12, 2007, 07:33:23 AM

Title: Build a window with Aurora
Post by: nico on July 12, 2007, 07:33:23 AM
I am not a beginner but I have never programmed with the classes, also I ask for your help to understand!

I have en error in my code:

Compiling...
Aurora1.src
No Errors

Linking...
Aurora Linker v1.0 Copyright ÂÃ,©2005,2006 Ionic Wind Software
Unresolved external MyWindow@Create
Error: Unresolved extern MyWindow@Create
Error(s) in linking C:\Program Files\Aurora\Aurora1.exe


My code:
//MyWindow definition
class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual Create(int l,int t,int w,int h,int style,int exstyle,string title,CWindow *parent),int;
declare virtual OnClose(),int;
int run;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}

MyWindow::_MyWindow()
{
}

global sub main()
{
MyWindow win;
win.Create(0,0,300,100,AWS_CAPTION | AWS_SYSMENU | AWS_AUTODRAW | AWS_VISIBLE | AWS_BORDER,0,"Demo",0);

win.CenterWindow();
win.run = 1;
do
{
wait();
} until win.run = 0;
return;
}

MyWindow::OnClose(),int
{
run = 0;
return true;
}


Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 07:46:12 AM
i do not declare //declare virtual Create(int l,int t,int w,int h,int style,int exstyle,string title,CWindow *parent),int; but i don't know why!
Title: Re: Build a window with Aurora
Post by: Bruce Peaslee on July 12, 2007, 08:27:45 AM
Remove the declare for Create. It is already part of Aurora. It will then run.
Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 08:30:52 AM
Thanks,

Another problem, where is my RichEdit?

//MyWindow definition
class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnCreate(),int;
declare virtual OnClose(),int;

CRichEdit *m_pRichEdit;

int run;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}

MyWindow::_MyWindow()
{
}


global sub main()
{
MyWindow win;
win.Create(0,0,300,300,AWS_CAPTION | AWS_SYSMENU | AWS_AUTODRAW | AWS_VISIBLE | AWS_BORDER,0,"Demo",0);

win.CenterWindow();
win.run = 1;
do
{
wait();
} until win.run = 0;
return;
}

MyWindow::OnCreate(),int
{
m_pRichEdit=new(CRichEdit,1);
m_pRichEdit->Create(10,10,280,280,AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL ,1,"",this);

}

MyWindow::OnClose(),int
{
run = 0;
return true;
}

Title: Re: Build a window with Aurora
Post by: Bruce Peaslee on July 12, 2007, 08:53:03 AM
Try this way:


//MyWindow definition
class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnCreate(),int;
declare virtual OnClose(),int;

int run;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}
MyWindow::_MyWindow()
{
}


global sub main()
{
MyWindow win;
win.Create(0,0,300,300,AWS_CAPTION | AWS_SYSMENU | AWS_AUTODRAW | AWS_VISIBLE | AWS_BORDER,0,"Demo",0);
win.AddControl(CTRICHEDIT,"",10,10,280,260,AWS_VISIBLE|AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL,0x200,1); // '1' is control number

win.CenterWindow();
win.run = 1;
do
{
wait();
} until win.run = 0;
return;
}

MyWindow::OnCreate(),int
{
}

MyWindow::OnClose(),int
{
run = 0;
return true;
}


Looks like it covers the whole window. Type into it.
Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 08:57:20 AM
Yes, but i try different method

It's run for a CComboBoxEx

Is there a bug?

//MyWindow definition



class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnCreate(),int;
declare virtual OnClose(),int;

CRichEdit *m_pRichEdit;

    CComboBoxEx *m_pComboBoxEx;


int run;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}

MyWindow::_MyWindow()
{
}


global sub main()
{
MyWindow win;
win.Create(0,0,300,300,AWS_CAPTION | AWS_SYSMENU | AWS_AUTODRAW | AWS_VISIBLE | AWS_BORDER,0,"Demo",0);

win.run = 1;
do
{
wait();
} until win.run = 0;
return;
}

MyWindow::OnCreate(),int
{
CenterWindow();
m_pRichEdit=new(CRichEdit,1);
m_pRichEdit->Create(10,10,280,280,AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL ,1,"",this);

    m_pComboBoxEx = new(CComboBoxEx, 1);
m_pComboBoxEx->Create(10,10,100,20,AWS_VISIBLE|ACBS_DROPDOWN,2,"",this);
}

MyWindow::OnClose(),int
{
run = 0;
return true;
}
Title: Re: Build a window with Aurora
Post by: Bruce Peaslee on July 12, 2007, 09:05:31 AM
Add AWS_VISIBLE.

Also, adjust the x,y as the controls currently overlap.
Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 09:25:02 AM
Thank's, sorry  for my stupidity  ::)
Title: Re: Build a window with Aurora
Post by: Bruce Peaslee on July 12, 2007, 09:42:52 AM
Quote from: nico on July 12, 2007, 09:25:02 AM
Thank's, sorry  for my stupidity  ::)
It's only stupid to refuse to seek help when you need it. We have all been there.

I believe you need to release the pointers.


MyWindow::OnClose(),int
{
delete m_pRichEdit;
delete m_pComboboxEx;
run = 0;
return true;
}
Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 09:43:26 AM
There is a bug, The border of RichEdit does not appear to the creation ! ???

//MyWindow definition
#INCLUDE "Windows.inc"

class MyWindow : CWindow
{
declare MyWindow();
declare _MyWindow();
declare virtual OnClose(),int;

int run;
}

//MyWindow Implementation
MyWindow::MyWindow()
{
}

MyWindow::_MyWindow()
{
}


global sub main()
{
MyWindow win;
win.Create(0,0,320,320,AWS_CAPTION | AWS_SYSMENU | AWS_AUTODRAW | AWS_VISIBLE | AWS_BORDER,0,"Demo",0);
win.AddControl(CTRICHEDIT,"",10,10,280,260,AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL|AWS_VISIBLE|WS_BORDER,0x200,1);
win.run = 1;
do
{
wait();
} until win.run = 0;
return;
}


MyWindow::OnClose(),int
{
//delete(m_pRichEdit);
run = 0;
return true;
}
Title: Re: Build a window with Aurora
Post by: Bruce Peaslee on July 12, 2007, 09:57:34 AM
For reasons that are unclear to me, Aurora uses some of its own window constants. Replace WS_BORDER with AWS_BORDER, like you have it in the window creation line.

Title: Re: Build a window with Aurora
Post by: nico on July 12, 2007, 10:04:13 AM
AWS_BORDER change nothing for me !

Also if i do:
   win.AddControl(CTRICHEDIT,"",10,10,280,260,AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL|AWS_VISIBLE|AWS_BORDER,0x200,1);

I can paste image


if i do:

m_pRichEdit->Create(10,10,280,280,AES_MULTILINE|AES_AUTOVSCROLL|AES_AUTOHSCROLL|AWS_VISIBLE ,1,"",this);

I can't paste image, it's normal?