Page 1 of 2 12>
Topic Options
#91498 - 2003-02-17 08:26 PM ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I am having trouble using the ObjectButton object in my script. I dont understand how to determine what option was chosen.

Can Anyone offer advice?

Thanks
_________________________
Austin Henderson

Top
#91499 - 2003-02-17 08:37 PM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
OptionButton ?

something like this :


break on

$form = createobject("kixtart.form")
$form.Caption = "OptionButton made easy ..."

$opt1 = $form.OptionButton("Option 1",20,20,80,15)
$opt2 = $form.OptionButton("Option 2",20,60,80,15)
$opt3 = $form.OptionButton("Option 3",20,100,80,15)

$Opt1.onclick = "Opt_CLick(1)"
$Opt2.onclick = "Opt_CLick(2)"
$Opt3.onclick = "Opt_CLick(3)"

$Opt1.Value = True
$lbl = $form.Label("Option 1 is selected",20,$Form.ClientHeight-20,$form.ClientWidth-40,15)

$form.Show
while $form.Visible
    $=execute($Form.DoEvents)
loop

exit 1

function Opt_Click($Opt)
    $lbl.Caption = "Option " + $Opt + " is selected"
endfunction

_________________________



Top
#91500 - 2003-02-17 09:19 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Great thanks for the help..

Would something like this work? Because I am doing something wrong I think.
code:
  Select
Case $Opt1.OnClick
$Choice = 1
Case $Opt2.OnClick
$Choice = 2
Case $Opt3.OnClick
$Choice = 3
Case $Opt4.OnClick
$Choice = 4
$UsrDB = $txtDBName.Text
EndSelect

_________________________
Austin Henderson

Top
#91501 - 2003-02-17 09:21 PM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Definetly,

as the OnClick Events are 'executed' in the DoEvents loop

You should declare each Event before the Loop (Execute-able)

hth
J.
_________________________



Top
#91502 - 2003-02-17 09:21 PM Re: ObjectButton
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
You can't do this because the OnClick denotes an event that triggers the execution of the specified function. It is not a value.
_________________________
There are two types of vessels, submarines and targets.

Top
#91503 - 2003-02-17 09:37 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I just figured that out... ; (

Hmm.. well here is what I am trying to do. Use the optionbutton to get user input but not do anything other than set a variable until I click my execute button.. but I need to set a value based on what is selected in the optionbutton group.

Can I do this?

Thanks
_________________________
Austin Henderson

Top
#91504 - 2003-02-17 09:39 PM Re: ObjectButton
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
code:
function Opt_Click($Opt)
$globalvalue = $opt
endfunction

_________________________
There are two types of vessels, submarines and targets.

Top
#91505 - 2003-02-18 12:07 AM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Ahh yes... I see... Dohh...

Thanks as always for the help.
_________________________
Austin Henderson

Top
#91506 - 2003-02-25 11:32 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Ok got the image working great.. now trying to use $Object.OnClick to open an html file.. cant seem to figure it out.. can anyone offer advice.
_________________________
Austin Henderson

Top
#91507 - 2003-02-25 11:33 PM Re: ObjectButton
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
Please show us your code.
_________________________
There are two types of vessels, submarines and targets.

Top
#91508 - 2003-02-25 11:41 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Cant get to it at the moment.. working on different machine. I will post it when I get back to my computer. Think something like this was my final attempt.

code:
 $ImageList 			= $Form.ImageList
$ImageList.ImageSize = 14,14
$ImageList.Images.Add("$InstallDir\help.bmp")

$HLPButton = $Form.ToolButton
$HLPButton.Size = 21,21
$HLPButton.Top = 2
$HLPButton.Icon = $ImageList.Images(0)
$HLPButton.Left = $lblprocessA.Left + $lblprocessA.WIDTH + 2
$HLPButton.OnClick = "Run $InstPath\help.htm"

Ahh could be the quotes because the path to the htm file has a space in it?

Will post the real one when I get back to my computer.

Thanks
_________________________
Austin Henderson

Top
#91509 - 2003-02-25 11:43 PM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Austin .. take a look at PostPrep 1.0.1 ... especially the function for button 'Preview' [Wink]
_________________________



Top
#91510 - 2003-02-25 11:44 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Not sure I know what postprep is? I will search the board for it.

Thanks
_________________________
Austin Henderson

Top
#91511 - 2003-02-25 11:47 PM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
PostPrep 1.0.1 - Update Release
_________________________



Top
#91512 - 2003-02-25 11:48 PM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
I think I see where you are going with this.. only trouble I might have is how to assigne the doc to open?

Will play with it tonight.

Thanks for the direction.
_________________________
Austin Henderson

Top
#91513 - 2003-02-26 01:51 AM Re: ObjectButton
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Austin,

If you look at my Signature you should see a couple of links to download the PostPrep 1.0.1 package.

[Big Grin] [Big Grin] [Big Grin] [Big Grin] [Big Grin]

Top
#91514 - 2003-02-26 04:01 AM Re: ObjectButton
Austin Offline
Seasoned Scripter

Registered: 2002-01-24
Posts: 439
Ok got it..
code:
 Function HlpBtn_Click()
Dim $ie,$doc,$f,$t
$ie = CreateObject("internetexplorer.application")
$ie.addressbar=0
$ie.menubar=0
$ie.toolbar=0
$ie.statusbar=0
$ie.navigate("$InstallDir\Help.htm")
$ie.visible=1
$Silent = SetFocus("PassSync Help Version $Build")
While $ie.visible Sleep 0.1 Loop
Exit
EndFunction

Now I have another question in the same line. If I want to be able to double click an image and call a function but I dont want to use the toolbutton because I dont want it to look like a button.. is there a way to make it flat?

Thanks
_________________________
Austin Henderson

Top
#91515 - 2003-02-26 08:15 AM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
That would be then the PictureBox() object ...

sample :



break on

$form = createobject("Kixtart.form")
$form.Caption = "PictureBox sample"

$pic = $form.PictureBox
$pic.Size = 256,256
$pic.Borderstyle = 0

$pic.Picture = "%SystemRoot%\Prairie Wind.bmp"
$pic.OnClick = "$$x = $$form.msgbox('You clicked me !!!',Kixforms,64)"

$pic.Center
$form.Show
while $form.Visible
    $=execute($Form.DoEvents)
loop

exit 1



Please note that the DoubleClick event was replaced by OnClick as it seems to happen that the event is not trapped within my latest build 38

J.
_________________________



Top
#91516 - 2003-02-26 08:24 AM Re: ObjectButton
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
I'm sorry... I can't click on YOU!!! right now.
Top
#91517 - 2003-02-26 08:27 AM Re: ObjectButton
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
crap ... Shawn should release build 38 as soon as possible !

Each of my sample failed since i have a completely different version [Frown]

Or .... do you just kidding ? [Eek!]

errg ... coffee break [Roll Eyes]

[ 26. February 2003, 08:29: Message edited by: jpols ]
_________________________



Top
Page 1 of 2 12>


Moderator:  Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 248 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.114 seconds in which 0.04 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org