April 23, 2024, 05:09:36 PM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Basic GUI questions

Started by Brandlingill, September 06, 2006, 11:36:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Brandlingill

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.

Rock Ridge Farm (Larry)

September 06, 2006, 12:00:43 PM #1 Last Edit: September 06, 2006, 12:03:15 PM by Rock Ridge Farm (Larry)
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.

Ionic Wind Support Team

#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.

Ionic Wind Support Team

Brandlingill

Thank you Paul. All 3 sorted.

Thank you too Larry. It didn't compile but I'll try again later as a learning project.

Rock Ridge Farm (Larry)

I think the window references need to be changed to Cwindow.
I should fix it - if time permits.

Bruce Peaslee

If I weren't so modestÂÃ,  8)ÂÃ,  I point you here: http://www.ionicwind.com/forums/index.php?topic=348.0
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

mrainey

Software For Metalworking
http://closetolerancesoftware.com

Rock Ridge Farm (Larry)

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

mrainey

Software For Metalworking
http://closetolerancesoftware.com