IonicWind Software

Aurora Compiler => GUI => Topic started by: Brandlingill on September 06, 2006, 11:36:55 AM

Title: Basic GUI questions
Post by: Brandlingill on September 06, 2006, 11:36:55 AM
Hi.

I took my first steps in making a basic GUI today, and I'm already in trouble *embarrassed*

Here is what I've done (by going through the examples in the documentation):

class myWindow : CWindow
{
declare virtual OnClose(),int;
declare virtual OnCreate(),int;
}

global sub main()
{
myWindow w;
w.Create(0, 0, 750, 500, AWS_VISIBLE|AWS_SYSMENU,0,"Test", NULL);
w.AddControl(CTLISTBOX,"Test",5,5,120,420,0x50000000,0x0,1);
w.AddControl(CTBUTTON,"Test",5,433,120,30,0x50000001,0x0,2);
w.AddControl(CTRICHEDIT,"Hello",130,5,610,460,0x50800000,0x200,3);

do
{
wait();
}
until !w.IsValid();
}

myWindow::OnCreate()
{
CenterWindow();
return 0;
}

myWindow::OnClose()
{
Destroy();
return 0;
}


Here's the things I have been trying to figure out:
1. How to change the background colour of the window
2. How to give the RichEdit box a border
3. How to add items to the ListBox - I know it is the 'AddString(text)' method but I don't see how to use it

I'd really appreciate some help, thanks.

Also, is there a list of what the hex values in the control flags mean? I have checked the constants section of the documentation but it isn't filled in at the moment.
Title: Re: Basic GUI questions
Post by: Rock Ridge Farm (Larry) on September 06, 2006, 12:00:43 PM
lots of the stuff you are asking about is in an old example I did.
http://www.ionicwind.com/forums/index.php?topic=229.0
Not sure it will still compile but it is a starting point.
There are lots of good examples in the Software Projects section.
Title: Re: Basic GUI questions
Post by: Ionic Wind Support Team on September 06, 2006, 12:10:12 PM
#1.  The SetWindowColor method of CWindow.


myWindow w;
w.Create(0, 0, 750, 500, AWS_VISIBLE|AWS_SYSMENU,0,"Test", NULL);
w.SetWindowColor(RGB(255,0,0));


#2. Add AWS_BORDER style by using the | opreator.


w.AddControl(CTRICHEDIT,"Hello",130,5,610,460,0x50800000 | AWS_BORDER,0x200,3);


#3.


    CListBox *pBox = win.GetControl(1);
    pBox->AddString("Hello there");
   do
   {
      wait();
   }
   until !w.IsValid();


The question depends on whether your using a dialog or window.  See the example program "weatherman.src".  In a dialog you initialize controls in the OnInitDialog handler.

The control flags are an ORed value and are different for every control.  There isn't really a convenient way to dehexify them.  The basic flag is AWS_CHILD | AWS_VISIBLE which turns out to be 0x50000000

Paul.

Title: Re: Basic GUI questions
Post by: Brandlingill on September 06, 2006, 12:21:49 PM
Thank you Paul. All 3 sorted.

Thank you too Larry. It didn't compile but I'll try again later as a learning project.
Title: Re: Basic GUI questions
Post by: Rock Ridge Farm (Larry) on September 06, 2006, 01:43:10 PM
I think the window references need to be changed to Cwindow.
I should fix it - if time permits.
Title: Re: Basic GUI questions
Post by: Bruce Peaslee on September 06, 2006, 02:41:24 PM
If I weren't so modestÂÃ,  8)ÂÃ,  I point you here: http://www.ionicwind.com/forums/index.php?topic=348.0
Title: Re: Basic GUI questions
Post by: mrainey on September 06, 2006, 03:59:45 PM
Bruce,

dead link - this one works:     http://www.campanilesystems.com/Programmers_Toolkit.zip
Title: Re: Basic GUI questions
Post by: Rock Ridge Farm (Larry) on September 06, 2006, 06:23:00 PM
Off Topic - Mike your machining software is how I found Aurora.
I found your site while taking a course in machining - from there I found Ibasic which I bought - then
discovered Aurora and been here since - so Thanks.l
Title: Re: Basic GUI questions
Post by: mrainey on September 06, 2006, 06:32:12 PM
You're sure welcome.   ;)