IonicWind Software

Aurora Compiler => GUI => Topic started by: Bruce Peaslee on January 21, 2006, 02:59:31 PM

Title: Image Loading
Post by: Bruce Peaslee on January 21, 2006, 02:59:31 PM
Do we have the capability of loading images and placing them into windows?
Title: Re: Image Loading
Post by: Bruce Peaslee on January 22, 2006, 09:54:40 AM
Found a solution on my ownÂÃ,  8)

dlg::OnInitDialog(), int
{
ÂÃ,  string sText;
ÂÃ,  CStatic *pLabel;
ÂÃ,  unsigned int hImage;

ÂÃ,  sText = "Program Name\n"ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, +ÂÃ, 
ÂÃ,  ÂÃ,  "ÂÃ,© 2006 Campanile Data Systems\n" +
ÂÃ,  ÂÃ,  "All Rights Reserved\n\n"ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ,  ÂÃ, +
ÂÃ,  ÂÃ,  "Version 0.01 1/21/06";
ÂÃ,  pLabel = GetControl(lblAboutText);
ÂÃ,  pLabel ->SetText(sText);
ÂÃ,  hImage = LoadImageA(GetModuleHandleA(0),"chezp",0,0,0,0); // "chezp" is resource id
ÂÃ,  if (hImage = null)
ÂÃ,  ÂÃ,  MessageBox(0,"Image failed to load","Internal Error",0);
ÂÃ,  pLabel = GetControl(lblAboutImage); // static control, SS_SUNKEN for nice look
ÂÃ,  pLabel ->SetImage(hImage);

ÂÃ,  CenterWindow();
ÂÃ,  return true;
}

Title: Re: Image Loading
Post by: Ionic Wind Support Team on January 22, 2006, 12:37:38 PM
The image functions are not done yet.  We will have load and show image soon.
Title: Re: Image Loading
Post by: Bruce Peaslee on January 22, 2006, 12:45:29 PM
Quote from: Ionic Wizard on January 22, 2006, 12:37:38 PM
The image functions are not done yet.ÂÃ,  We will have load and show image soon.

I thought so. However, it's good for me to see if I can figure this stuff out while we wait for the language to be fleshed out. One cannot have too much experience with MSDN and the API!

Title: Re: Image Loading
Post by: Ionic Wind Support Team on January 22, 2006, 12:49:24 PM
You did a good job ;)

Both the button and static classes have a SetImage method.   If creating your controls manually, without the dialog editor, use the styles ABS_BITMAP or ASS_BITMAP.

Paul.

Title: Re: Image Loading
Post by: Bruce Peaslee on January 22, 2006, 04:25:27 PM
Here is an example of putting an image onto your main window:


global sub main()
{
ÂÃ,  def winMain as myWindow;
ÂÃ,  CStatic Image;

ÂÃ,  winMain.Create(0,0,640,440,
ÂÃ,  ÂÃ,  AWS_CAPTION|AWS_VISIBLE|AWS_BORDER|AWS_SYSMENU|AWS_AUTODRAW|AWS_SIZE|
ÂÃ,  ÂÃ,  ÂÃ,  AWS_MAXIMIZEBOX|AWS_MINIMIZEBOX,
ÂÃ,  ÂÃ,  ÂÃ,  0," Cafe Critique",NULL);

ÂÃ,  winMain.SetWindowColor(GetSysColor(15));
ÂÃ,  Image.m_hwnd = CreateWindowEXA(0,"STATIC","",
ÂÃ,  ÂÃ,  ASS_BITMAP|AWS_CHILD|AWS_VISIBLE|SS_NOTIFY|SS_CENTERIMAGE|SS_SUNKEN,
ÂÃ,  ÂÃ,  30,30,
ÂÃ,  ÂÃ,  170,255,
ÂÃ,  ÂÃ,  winMain.m_hwnd,1,GetModuleHandleA(0),null);

ÂÃ,  Image.SetImage(LoadImageA(GetModuleHandleA(0),"chezp2",0,0,0,0)); //chezp2 = resource ID

ÂÃ,  // message loop
ÂÃ,  do
ÂÃ,  {
ÂÃ,  ÂÃ,  wait();
ÂÃ,  }until winMain.m_run = 0;
ÂÃ,  return 0;
}



(It's just a scrap and won't compile as is.)