July 02, 2024, 04:11:01 PM

News:

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


Create Links Within Dialog Window

Started by rhuckle, April 28, 2008, 07:31:13 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

rhuckle

Hi i have a few dialogs and 1 window that contains all dialogs (which are opened via 3 buttons)

wanting to do is create a links dialog as in clickable and then opens web browser even if its the web browser from ebasic this will be ok too

i searched forums on howto but did not find anything about creating licks like Click Here for java info in the about page etc.. that redirects them to the url in question

regards

Ricky H

pistol350

Hi rhuckle!
Maybe you mean Hypertext Link ?

if so, Sapero wrote a hyperlink Class in Aurora.
search the forum and you may find it
Regards,

Peter B.

LarryMc

This uses Sapero's windows.inc. but you should be able to follow what's going on.

AutoDefine "off"
$Include "windows.inc"
DECLARE IMPORT, _LoadCursor ALIAS LoadCursorA(hInstance AS INT,lpCursorName AS STRING),INT
DECLARE IMPORT, _SetClassLong ALIAS SetClassLongA(hwnd AS INT,nIndex AS INT,dwNewLong AS INT),INT
Int sh,pcur,change,cid
Dialog d1
const IDC_HAND         =32649
'CONST GCL_HCURSOR = -12
'const IDC_ARROW         =32512
CONST MOUSE_ENTER = 0x9000
CONST MOUSE_LEAVE = MOUSE_ENTER+1

CreateDialog d1,0,0,295,168,0x80C80080,d1,"About",&about
Control d1,@Static,"Click here To visit the home of EBasic",32,106,230,20,0x50000101,1
Control d1,@SysButton,"Ok",112,136,70,20,0x50030000,2


Domodal d1
End

Sub about()
Select @Class
   Case WM_SetCursor
      cid = GetDlgCtrlID(@Code)
      If (cid = 1) AND (change = 0)
         SetFont d1,"",8,400,@SFUnderLine,1
         SetControlColor d1,1,0x0000FF,GetSysColor(30)
pcur = _SetClassLong(sh,GCL_HCURSOR,pcur)
         change = 1
      Else:If (cid <> 1) AND (change = 1)
         SetFont d1,"",8,400,0,1
         SetControlColor d1,1,0xFF0000,GetSysColor(30)
         pcur = _SetClassLong(sh,GCL_HCURSOR,pcur)
         change = 0
        EndIf:EndIf
   Case @IDControl
      If @NotifyCode=0
         If @ControlID = 1
            System "http://www.ionicwind.com"
            SendMessage (d1,WM_SetCursor,0,sh)
         EndIf
         If @ControlID = 2 Then CloseDialog d1,@IDOK
      EndIf
   Case @IDInitDialog
      CenterWindow d1
pcur=LoadCursorA(0,IDC_HAND)
      sh = GetControlHandle(d1,1)
endselect

Return
EndSub


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

rhuckle

Quote from: Larry McCaughn on April 28, 2008, 03:14:59 PM
This uses Sapero's windows.inc. but you should be able to follow what's going on.

AutoDefine "off"
$Include "windows.inc"
DECLARE IMPORT, _LoadCursor ALIAS LoadCursorA(hInstance AS INT,lpCursorName AS STRING),INT
DECLARE IMPORT, _SetClassLong ALIAS SetClassLongA(hwnd AS INT,nIndex AS INT,dwNewLong AS INT),INT
Int sh,pcur,change,cid
Dialog d1
const IDC_HAND         =32649
'CONST GCL_HCURSOR = -12
'const IDC_ARROW         =32512
CONST MOUSE_ENTER = 0x9000
CONST MOUSE_LEAVE = MOUSE_ENTER+1

CreateDialog d1,0,0,295,168,0x80C80080,d1,"About",&about
Control d1,@Static,"Click here To visit the home of EBasic",32,106,230,20,0x50000101,1
Control d1,@SysButton,"Ok",112,136,70,20,0x50030000,2


Domodal d1
End

Sub about()
Select @Class
   Case WM_SetCursor
      cid = GetDlgCtrlID(@Code)
      If (cid = 1) AND (change = 0)
         SetFont d1,"",8,400,@SFUnderLine,1
         SetControlColor d1,1,0x0000FF,GetSysColor(30)
pcur = _SetClassLong(sh,GCL_HCURSOR,pcur)
         change = 1
      Else:If (cid <> 1) AND (change = 1)
         SetFont d1,"",8,400,0,1
         SetControlColor d1,1,0xFF0000,GetSysColor(30)
         pcur = _SetClassLong(sh,GCL_HCURSOR,pcur)
         change = 0
        EndIf:EndIf
   Case @IDControl
      If @NotifyCode=0
         If @ControlID = 1
            System "http://www.ionicwind.com"
            SendMessage (d1,WM_SetCursor,0,sh)
         EndIf
         If @ControlID = 2 Then CloseDialog d1,@IDOK
      EndIf
   Case @IDInitDialog
      CenterWindow d1
pcur=LoadCursorA(0,IDC_HAND)
      sh = GetControlHandle(d1,1)
endselect

Return
EndSub


Larry

when i used thie above code in blank project to test i got these errors

Compiling...
URLs.eba
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (3) duplicate declaration - INT
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (4) duplicate declaration - INT
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (24) Warning: undeclared function 'GetDlgCtrlID'
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (27) Warning: undeclared function 'GetSysColor'
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (32) Warning: undeclared function 'GetSysColor'
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (46) Warning: undeclared function 'LoadCursorA'
Error(s) in compiling C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba
Build Failed

any help on this will be great

pistol350

Thank you Larry for this neat example  8)

Rhuckle,
as Larry said, this example uses Sapero's windows include files.
You can find a link to the latest release at the bottom of each post by Sapero or simply here for the current latest release : http://www.ionicwind.com/forums/index.php/topic,633.msg19759.html#msg19759

By the way, my advice to you before you install the header Pak is to go to your INCLUDES directory and rename
your current WINDOWS.INC file so that it is not overwritten during the install.

After this your code above should compile like a charm  :)

Hope that really helps.
Regards,

Peter B.

rhuckle

Quote from: pistol350 on April 28, 2008, 11:45:37 PM
Thank you Larry for this neat example  8)

Rhuckle,
as Larry said, this example uses Sapero's windows include files.
You can find a link to the latest release at the bottom of each post by Sapero or simply here for the current latest release : http://www.ionicwind.com/forums/index.php/topic,633.msg19759.html#msg19759

By the way, my advice to you before you install the header Pak is to go to your INCLUDES directory and rename
your current WINDOWS.INC file so that it is not overwritten during the install.

After this your code above should compile like a charm  :)

Hope that really helps.


i did have this installed all of his headers but im unsure weather the ebasic update 1.61 i done may have changed something please advise as all downloads and libraries needed should be installed

pistol350

I think indeed that your windows.inc file from Sapero's headers was overwritten so you should reinstall the header pak
Regards,

Peter B.

rhuckle

Quote from: pistol350 on April 29, 2008, 12:14:48 AM
I think indeed that your windows.inc file from Sapero's headers was overwritten so you should reinstall the header pak

ok i reinstalled the feb 2008 headers and now i am presented with these errors

Compiling...
URLs.eba
File: oaidl.inc (555) Duplicate interface declaration - IDispatch
File: oaidl.inc (556) STDMETHOD statement encountered outside of INTERFACE - HRESULT
File: oaidl.inc (557) STDMETHOD statement encountered outside of INTERFACE - ULONG
File: oaidl.inc (558) STDMETHOD statement encountered outside of INTERFACE - ULONG
File: oaidl.inc (560) STDMETHOD statement encountered outside of INTERFACE - HRESULT
File: oaidl.inc (561) STDMETHOD statement encountered outside of INTERFACE - HRESULT
File: oaidl.inc (562) STDMETHOD statement encountered outside of INTERFACE - HRESULT
File: oaidl.inc (563) STDMETHOD statement encountered outside of INTERFACE - HRESULT
File: oaidl.inc (564) ENDINTERFACE without matching INTERFACE - endinterface
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (28) Warning: undeclared function '_SetClassLong'
File: C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba (33) Warning: undeclared function '_SetClassLong'
Error(s) in compiling C:\apache2triad\htdocs\inc\javaServer\src\URLs.eba
Build Failed

the previous errors now gone but whole new set appear and im using the example above in blank project so should compile as far as im aware

pistol350

Hi Rhuckle!

The lines of code about the IDispatch library interfere with the latest updates Paul released with the version 1.6 and above.

you just have to comment these lines like below for instance :


/*
interface IDispatch ' IUnknown
stdmethod QueryInterface(pointer riid,pointer ppvObject),HRESULT
stdmethod AddRef(),ULONG
stdmethod Release(),ULONG

stdmethod GetTypeInfoCount(pointer pctinfo),HRESULT
stdmethod GetTypeInfo(UINT iTInfo,LCID lcid,pointer ppTInfo),HRESULT
stdmethod GetIDsOfNames(pointer riid,pointer rgszNames,UINT cNames,LCID lcid,pointer rgDispId),HRESULT
stdmethod Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,USHORT wFlags,pointer pDispParams,pointer pVarResult,pointer pExcepInfo,pointer puArgErr),HRESULT
endinterface
*/


I also see a  strange " undeclared function '_SetClassLong' " error, while it is declared at the top of the source provided by Larry :

DECLARE IMPORT, _SetClassLong ALIAS SetClassLongA(hwnd AS INT,nIndex AS INT,dwNewLong AS INT),INT

Maybe you commented it, in that case you should uncomment it.

Regards,

Peter B.

rhuckle

Quote from: pistol350 on April 29, 2008, 12:42:19 AM
Hi Rhuckle!

The lines of code about the IDispatch library interfere with the latest updates Paul released with the version 1.6 and above.

you just have to comment these lines like below for instance :


/*
interface IDispatch ' IUnknown
stdmethod QueryInterface(pointer riid,pointer ppvObject),HRESULT
stdmethod AddRef(),ULONG
stdmethod Release(),ULONG

stdmethod GetTypeInfoCount(pointer pctinfo),HRESULT
stdmethod GetTypeInfo(UINT iTInfo,LCID lcid,pointer ppTInfo),HRESULT
stdmethod GetIDsOfNames(pointer riid,pointer rgszNames,UINT cNames,LCID lcid,pointer rgDispId),HRESULT
stdmethod Invoke(DISPID dispIdMember,REFIID riid,LCID lcid,USHORT wFlags,pointer pDispParams,pointer pVarResult,pointer pExcepInfo,pointer puArgErr),HRESULT
endinterface
*/


I also see a  strange " undeclared function '_SetClassLong' " error, while it is declared at the top of the source provided by Larry :

DECLARE IMPORT, _SetClassLong ALIAS SetClassLongA(hwnd AS INT,nIndex AS INT,dwNewLong AS INT),INT

Maybe you commented it, in that case you should uncomment it.



thankyou for this information i comment out the code you mentioned in the inc file and then compiled and all now is okay works like a charm, i however made a few adjustments so that the whole hypertext sub routines were created into a dll this will make it easier next time for me to add to other apps :)

maybe later on even an adition to here for other simply drop the dll into there app directory and add code to there app and away they go they will have urls, im assuming the case also for users that dont have the headers and comment out the stuff like i did if the dll i create functions the way i hope  others may not need to do this for simple projects sorta like creating a class but a dll instead

any thooughts on this would be apreciated, i got given great help and if this can help others ill be willing to create a dll and guide for howto implement Hyper Text URLs to windows / dialogs within Ebasic I woudnt Need To Provide The include File For The DLL As Users Have The Ability to Import It From The DLL So Just The Guid For Howto Use The DLL Would Be Needed And Example Code With The DLL In Use

pistol350

Hi Rhuckle!

By my side i was rather thinking about writing a simple subroutine being a function with parameters.
that can be implemented faster than a DLL and simply put in a .inc file (just like the SAVEBITMAP function ) .

But if you think a DLL is a better idea, i am with you.
Regards,

Peter B.

rhuckle

Quote from: pistol350 on April 29, 2008, 04:38:06 AM
Hi Rhuckle!

By my side i was rather thinking about writing a simple subroutine being a function with parameters.
that can be implemented faster than a DLL and simply put in a .inc file (just like the SAVEBITMAP function ) .

But if you think a DLL is a better idea, i am with you.

i only suggested the dll as this file is spepearte to ebasic include files, the ebasic headers by sapero thus if these are update the dll will not cause any issues with adding it to ebasic all it needs to have is put in a folder with distribution of ebasic say in the redist folder for redistributing with your app, if you want to use hyper text links within your app windows and or dialog simply read the help.chm for the plugin for ebasic add your code to the app and compile, add the dll to directory and away you go.

i already have created the dll using examples on here how to create dlls and the code seems clean and works greate and file size for the dll is around 30-40KB so its fairly small..

its very easy to use and not hard as im very new to ebasic (but very quick study mind you :)) and i managed so i think it could be somthing that we could consider, i can always distribute dll here and example how to implement to see if it can be added to any project if the answer is yes i can than create a chm file for ebasic and the incc file for the help and create the redist folder but i think the headers install does this for you. then zip and send to paul or just post here