April 25, 2024, 07:34:18 PM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


"About" box - how?

Started by Egil, February 05, 2011, 05:01:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Egil

In may latest "masterpiece" I wanted an "About" box, and solved it by using a MESSAGEBOX.
But I want to include a bitmap, and maybe an "active" URL that starts my internet browser when clicked.
How can this be done?


Egil
Support Amateur Radio  -  Have a ham  for dinner!

Bruce Peaslee

You can use a regular dialog.

For the image, create a bitmap resource and add it to the dialog:

Control dlgAbout, @STATIC, "Campanile",  40, 30,178,146, @CTLSTCBITMAP|SS_SUNKEN, 1

I think for the link, just have a static control respond to the mouse (I couldn't find my example).
Bruce Peaslee
"Born too loose."
iTired (There's a nap for that.)
Well, I headed for Las Vegas
Only made it out to Needles

Egil

Thanks a lot, Bruce!
Using a dialog just had slipped my mind... hehe. Now I know how to proceed.

Egil
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

Egil
Here's some sample code from my button designer. It doesn't have an image but it does show how I centered my text and how I created aurl link.
CREATEDIALOG about,0,0,300,210,0x80C00080,win_main,"About",&DoAbout
CONTROL about,@GROUPBOX,"",6,6,288,160,0x50000007,1
if ver_id=1
CONTROL about,@STATIC,"Custom Button Designer II (Demo) for Emergence Basic",14,24,274,14,0x50000101,2
else
CONTROL about,@STATIC,"Custom Button Designer II for Emergence Basic",14,24,274,14,0x50000101,2
endif


CONTROL about,@STATIC,"Version "+ver_major+"."+ver_minor+" - "+ver_date,14,50,274,14,0x50000101,4
CONTROL about,@STATIC,"Copyright Ã,© 2009 T. L. McCaughn",14,65,274,14,0x50000101,5
CONTROL about,@STATIC,"All Rights Reserved",14,80,274,14,0x50000101,6
CONTROL about,@STATIC,"Written/Compiled in",14,105,274,14,0x50000101,7
CONTROL about,@STATIC,"Emergence Basic Version 1.72",14,120,274,14,0x50000101,8
CONTROL about,@STATIC,"Copyright Ã,© 2006-2009 Ionic Wind Software",14,135,274,14,0x50000101,9
CONTROL about,@BUTTON,"OK",120,175,60,20,0x50010001,20
return
endsub

int sh,cid,chng
global SUB DoAbout

SELECT @CLASS
CASE @IDINITDIALOG
CENTERWINDOW about
SETCONTROLCOLOR about,2,RGB(0,0,255),_Getsyscolor(15)
        SetControlColor about,8,0xFF0000,_Getsyscolor(15)
SETCONTROLCOLOR about,20,RGB(0,0,0),RGB(0,192,192)
cid=0:chng=0
      sh = GetControlHandle(about,8)
CASE @IDCONTROL
SELECT @CONTROLID
case 8
            System "http://www.ionicwind.com/"
            SendMessage (about,WM_SetCursor,0,sh)
CASE 20
CLOSEDIALOG about,@IDOK
ENDSELECT
  Case WM_SetCursor
      cid = _GetDlgCtrlID(@Code)
if (cid = 8) AND (chng = 0)
SetFont about,"",8,400,@SFUnderLine,8
SetControlColor about,8,0x0000FF,_Getsyscolor(15)
chng = 1
Else
If (cid <> 8)AND (chng = 1)
SetFont about,"",8,400,0,8 
SetControlColor about,8,0xFF0000,_Getsyscolor(15)
chng = 0
EndIf
endif
ENDSELECT
RETURN
ENDSUB


LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Thanks Larry!

Now the only part left for me, is the easy one ;D ;D ;D

Regards
Egil
Support Amateur Radio  -  Have a ham  for dinner!

Egil

The dialog part was easy, but when I came to the "URL"-part, it wasn't as easy as I thought after all. This is one of the fields where IWB really excells when compared to CB. And the nice examples you both gave, has proven impossible to translate so far.
But I think it will be possible to get around the problem after all, only need a little more time. After all, I could always define the URL-part as a button, but I am going to try to avoid just that.

This is what makes programming so exiting!

Egil
Support Amateur Radio  -  Have a ham  for dinner!

LarryMc

February 07, 2011, 07:07:02 AM #6 Last Edit: February 07, 2011, 07:16:13 AM by LarryMc
Here's a CB example.
DECLARE "user32.dll",GetSysColor(nIndex:INT),INT
DECLARE "user32.dll",GetDlgItem(hDlg:INT, nIDDlgItem:INT),INT
DECLARE "user32.dll",GetDlgCtrlID(hwnd:INT),INT

CONST WM_SETCURSOR = &H20

DEF d1:DIALOG
DEF answer,cid,chng,sh:INT
DEF myicon:int

DIALOG d1,0,0,300,210,@CAPTION|@SYSMENU,0,"About",dialoghandler
CONTROL d1,"T,My Program,14,24,274,14,0x50000101,1"
CONTROL d1,"T,Version 1.0,14,50,274,14,0x50000101,2"
CONTROL d1,"T,Copyright Ã,© 2011 Egil,14,65,274,14,0x50000101,3"
CONTROL d1,"T,All Rights Reserved,14,80,274,14,0x50000101,4"
CONTROL d1,"T,Written/Compiled in,14,105,274,14,0x50000101,5"
CONTROL d1,"T,IWBasic Version 1.80,14,120,274,14,0x50000101,6"
CONTROL d1,"T,Copyright Ã,© 2011 Ionic Wind Software,14,135,274,14,0x50000101,7"
CONTROL d1,"B,OK,120,175,60,20,0x50010001,8"
answer = DOMODAL(d1)
end

sub dialoghandler
select @CLASS
case @IDINITDIALOG
CENTERWINDOW d1
SetControlColor d1,6,0xFF0000,Getsyscolor(15)
SETCONTROLCOLOR d1,8,RGB(0,0,0),RGB(0,192,192)
cid=0:chng=0
SETICON d1,myicon
sh = GetDlgItem(d1.hwnd,6)
case @IDCONTROL
select @CONTROLID
case 6
System "http://www.ionicwind.com/"
           SendMessage (d1,WM_SetCursor,0,sh)

case 8
closedialog d1,@IDOK
endselect
Case WM_SetCursor
      cid = GetDlgCtrlID(@Code) - 2024
if (cid = 6) & (chng = 0)
SetFont d1,"",8,400,@SFUnderLine,6
SetControlColor d1,6,0x0000FF,Getsyscolor(15)
chng = 1
Else
If (cid <> 6)& (chng = 1)
SetFont d1,"",8,400,0,6  
SetControlColor d1,6,0xFF0000,Getsyscolor(15)
chng = 0
EndIf
endif

endselect
return



LarryMc
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

Egil

Thanks Larry!

I will be going away for the rest of the week, but taking my netbook with me. So I will certainly study your code and borrow the parts I can use. I dont know what access I will have to the internet, if any, but anyway I'll be back late friday night. When I post the code you'll see form yourself how much I have copied.... :D

egil
Support Amateur Radio  -  Have a ham  for dinner!