KiXforms Forum Index KiXforms
The Forum for the KiXforms Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Quick Links 
Site News
Downloads
Documentation
Donations
Script Archive
Tracking Systems

Form Icon

 
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion
View previous topic :: View next topic  
Author Message
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Mon Jan 09, 2006 10:43 pm    Post subject: Form Icon Reply with quote

I don't know if I am just missing something, but I am very new (Today) to .NET, but when I try and assign an icon to my form, it shows in the control box, but when I run it, I don't get the proper icon. I get the default icon.

Any ideas on what I am doing wrong?
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Mon Jan 09, 2006 11:47 pm    Post subject: Reply with quote

Are you using the Kixforms.NET Designer ?
Back to top
View user's profile Send private message
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Tue Jan 10, 2006 12:45 am    Post subject: Reply with quote

Yup. Just downloaded it today.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jan 10, 2006 1:02 am    Post subject: Reply with quote

The current version of Kixforms Designer does allow you to specify an icon, or a bitmap ... but it doesn't support actually writing-out the code to do this to "the source file" ...

Having said that, for now, once your done designing the form .. have to manually go into your code and type something like:

$Form.Icon = $System.Icon.FromFile("myicon.ico")

or however you want to load the icon. Talking to Benny (Kixforms Designer), apparentlt this feature will in in a future release - but not today.
Back to top
View user's profile Send private message
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Tue Jan 10, 2006 3:42 pm    Post subject: Reply with quote

Awesome...

Is there anyway to "embed" the icon into the file, so it doesn't have to follow?

Because basically once I create the form I'm going to use ASE to create an EXE.

Or is that what you are referring to above?
Back to top
View user's profile Send private message
Jochen
KiXforms Devotee
KiXforms Devotee


Joined: 05 Mar 2003
Posts: 1204
Location: Stuttgart, Germany

PostPosted: Tue Jan 10, 2006 3:45 pm    Post subject: Reply with quote

Hmmm ... is the base64 stuff already in kf.net ??
Doesn't seem so Cunning

_________________
Jochen

Tell me, and I will forget.
Show me, and I may remember.
Involve me, and I will understand.
Back to top
View user's profile Send private message MSN Messenger
dataspike
KiXforms Follower
KiXforms Follower


Joined: 07 Mar 2005
Posts: 15

PostPosted: Tue Jan 10, 2006 4:07 pm    Post subject: Reply with quote

dataspike wrote:
Awesome...

Is there anyway to "embed" the icon into the file, so it doesn't have to follow?

Because basically once I create the form I'm going to use ASE to create an EXE.

Or is that what you are referring to above?

Nevermind... I found that if I just package the ICO file with the EXE it'll work, so that's enough of a band-aid for me now, unless we can embed it.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jan 10, 2006 4:24 pm    Post subject: Reply with quote

I did add the Base64 functions to kf.net ... and it supports embedding both Bitmap and Icon resource ... for spike's benefit, let me give you the 10 cent tour of embedding icons into the script.

1) Assume you have an icon file - lets call it user.ico.

2) Run user.ico throught the base64 utility ... this converts the ico file into base64 encoded string, the command line is:

base64 user.ico user.b64

You can find base64 in the Kixforms Resource Development kit that is listed in the Kixforms Classic stiky thread in the Announcement forum.

3) If you edit the user.b64 file, you will see something like this:

AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD/
/wD/AAAA/wD/AP//AAD///8A////////////9ERERET///9MxER0xE////RHf3hE/////wj/
gE/////wAPd3cP////AAD//w////AACP/3D///8AAP//9w///wAAj/fHD///AAAAf4D///8A
AAAP9w////AAAAAAD////wAAAAAP////8AAAAP////////////8AAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Like I said, this is your encoded icon.

4) Create a simple form script and plug this string into the script and use the FromBase64String method of the Icon class, to create an instance of your icon (just as if you had read it from the ico file) ... here is a working example - give it a try - look for the "USER" icon in the titlebar.

Code:

Break On

$System = CreateObject("Kixforms.System")

$Form = $System.Form()
$Form.Text = "Demo"
$Form.Icon = $System.Icon.FromBase64String(UserIconString())

$Form.Center
$Form.Show
While $Form.Visible
 $= Execute($System.Application.DoEvents)
Loop

Exit 0

Function UserIconString()
$UserIconString = "
AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD/
/wD/AAAA/wD/AP//AAD///8A////////////9ERERET///9MxER0xE////RHf3hE/////wj/
gE/////wAPd3cP////AAD//w////AACP/3D///8AAP//9w///wAAj/fHD///AAAAf4D///8A
AAAP9w////AAAAAAD////wAAAAAP////8AAAAP////////////8AAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
"
EndFunction


You will notice that we dont actually plug the string directly into the function, we use a UDF to "wrap" the string - do this for two reasons:

1) It makes the code easier to read, plus all the embedded resources are located at the end of the script ...

2) ASE has the expand/collapse region (for UDF) feature - which allows you to hide all these resources strings unless you want to expand and see them.

Note: watch how the base64 copy / paste works with these files ... sometimes the lines go in as double spaced etc. And sometimes the lines get scrunched ... shouldn't really matter too much as long as one doesn't change the content of the encoding.

If you need more info on how to get and use this base64.exe utility, please advise. Like i said - its works for bitmaps as well.
Back to top
View user's profile Send private message
Shawn
KiXforms Developer
KiXforms Developer


Joined: 22 Feb 2003
Posts: 1983
Location: Canada

PostPosted: Tue Jan 10, 2006 4:30 pm    Post subject: Reply with quote

That encoded icon was a bad example actually, because the transparency for it really isn't there - transparency works just fine ... here is another encoded string for you to plug into that script - won't tell you what the icon is, you tell me ;0)

Code:

AAABAAEAEBAQAAAAAAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAwAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD/
/wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAD7+/AAAAAAv7+/v7AAAAv7+/v7+wAAD7C/
v7+/AAD7+wv7+/vwAL+/sL+/v7AA+/v7AAAA8AC/v7+/v7+wAPv7+/v7+/AAD7+/v7+/AAAL
+/v7+/sAAAC/vw+/sAAAAAD7+/AAAAAAAAAAAAAAAAAAAAAAAAD8HwAA8AcAAOADAADAAQAA
wAEAAIAAAACAAAAAgAAAAIAAAACAAAAAwAEAAMABAADgAwAA8AcAAPwfAAD//wAA
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    KiXforms Forum Index -> KiXforms.NET Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group