Home > Archive > Clarion > October 2004 > how to click by code the button on diffrent window ?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to click by code the button on diffrent window ?
|
|
| bob tanujaya 2004-10-03, 3:55 am |
| suppose I have two window in diffrent thread, there is a button in
window A, and in the window b, what I want is to is click to run the
button in window A using codding in window B, so how to click diffrent
window's button by coding ? any Ideas ? Thanks...
rgds Bob
| |
|
| Let one window post Event:Accepted to the button on the other window.
Look up "Post" in the help.
If the windows aren't in the same module, you will need to pass
references to the button (control number) and the window (thread number)
to the one window who calls the other. For this you can use parameters
or global variables. If the windows are in the same module you can
simply refer to the control- and window-labels.
Hope this helps
Best regards
Kasper
--
Besøg mig på nettet: http://www.kaspershjemmeside.dk
| |
| bob tanujaya 2004-10-05, 3:55 am |
| Hi, Kasper
Would you please give me more detail,example and the syntax of posting
in diffrent window, because I am a new clarion user.
I have try :
1.make two global variable : glo:Win1Thread (type is byte) and
glo:Win1Ref (type is window).
2. in the init method of win1 I put a embed : glo:Win1Thread =thread()
and glo:Win1Ref &=Window
3. in the button of win1, in the button property use:?button1, I add
control field let say 2, so in the Use's field like this : ?button,2
(I don't know it's correct or not to assign a field control number ?)
4. I try to post the button in the same window :
post(event:accept,?button1), and runs ok.
5. so how to post the button in the diffrent window and diffrent
thread ? I try : post(event:accepted,gol:Win1Ref$2), but it's failed,
so I don't know what is the syntax of posting event : accept in
reference variable + thread variable and control button number ?
best Regards Bob
thanks.
kgc <news1@kaspershjemmeside.dk> wrote in message news:<41602e58$0$207$edfadb0f@dread12.news.tele.dk>...
> Let one window post Event:Accepted to the button on the other window.
> Look up "Post" in the help.
>
> If the windows aren't in the same module, you will need to pass
> references to the button (control number) and the window (thread number)
> to the one window who calls the other. For this you can use parameters
> or global variables. If the windows are in the same module you can
> simply refer to the control- and window-labels.
>
> Hope this helps
>
> Best regards
>
> Kasper
| |
|
| Hi
> Would you please give me more detail,example and the syntax of posting
> in diffrent window, because I am a new clarion user.
I can try - but since I haven't clarion installed at home (only at
work), I'm not sure if I can remeber everything correctly - but if I
doesn't suceed, I can look it up at work tomorrow. Your steps aren't
that wrong. But here goes:
> 1.make two global variable : glo:Win1Thread (type is byte) and
> glo:Win1Ref (type is window).
When you have the Glo:Win1Thread variable, you doesn't need the
window-reference too (threadnumber or window-reference is enough), but
you shold have a "reference" to the button ie. the control-number of the
button. So instead of Glo:Win1Ref you could have Glo:Win1Button (I think
type should be Long, but I'm not 100% sure). The type of Glo:Win1Thread
should be the same as the returntype og Thread() - I think that is Long,
but check the help (most possibly it will work with byte, since the
threadnumber isn't that big - but use the correct type just to be sure)
> 2. in the init method of win1 I put a embed : glo:Win1Thread =thread()
> and glo:Win1Ref &=Window
Glo:Win1Thread = Thread() is fine (case doesn't mattter). You shold also
put Glo:Win1Button = ?Button1 (the label "?Button1" is just a
placeholder for the internal "controlnumber")
> 3. in the button of win1, in the button property use:?button1, I add
> control field let say 2, so in the Use's field like this : ?button,2
> (I don't know it's correct or not to assign a field control number ?)
The use-field just specifies the name of the button. Leave it as
?Button1 - the control-number is automaically assigned by clarion.
> 4. I try to post the button in the same window :
> post(event:accept,?button1), and runs ok.
OK, check that this is still so.
> 5. so how to post the button in the diffrent window and diffrent
> thread ? I try : post(event:accepted,gol:Win1Ref$2), but it's failed,
> so I don't know what is the syntax of posting event : accept in
> reference variable + thread variable and control button number ?
Look up post in the help! I think it is like this:
Post(Event:Accepted, Glo:Win1Thread, Glo:Win1Button)
but I might have the wrong order of the thread and controlnumber
parameters!?
Before posting you should check that win1 is open. For example by
checking that Glo:Win1Thread <> 0. If you use this check, remember to
Clear(Glo:Win1Thread) when killing win1.
Tell me if this works out. Otherwise I might get time to make a little
example tomorrow at work.
Best regards
Kasper
--
Besøg mig på nettet: http://www.kaspershjemmeside.dk
| |
| bob tanujaya 2004-10-05, 8:55 am |
| Hi Sir,
Great and it runs well! the right order is :
Post(Event:Accepted, Glo:Win1Button, Glo:Win1Thread)
So you don't need to get time for making the example.
Thank You Very much!!!
RGDS Bob.
kgc <news1@kaspershjemmeside.dk> wrote in message news:<416245a1$0$265$edfadb0f@dread12.news.tele.dk>...
> Hi
> I can try - but since I haven't clarion installed at home (only at
> work), I'm not sure if I can remeber everything correctly - but if I
> doesn't suceed, I can look it up at work tomorrow. Your steps aren't
> that wrong. But here goes:
>
> When you have the Glo:Win1Thread variable, you doesn't need the
> window-reference too (threadnumber or window-reference is enough), but
> you shold have a "reference" to the button ie. the control-number of the
> button. So instead of Glo:Win1Ref you could have Glo:Win1Button (I think
> type should be Long, but I'm not 100% sure). The type of Glo:Win1Thread
> should be the same as the returntype og Thread() - I think that is Long,
> but check the help (most possibly it will work with byte, since the
> threadnumber isn't that big - but use the correct type just to be sure)
>
> Glo:Win1Thread = Thread() is fine (case doesn't mattter). You shold also
> put Glo:Win1Button = ?Button1 (the label "?Button1" is just a
> placeholder for the internal "controlnumber")
>
> The use-field just specifies the name of the button. Leave it as
> ?Button1 - the control-number is automaically assigned by clarion.
>
> OK, check that this is still so.
>
> Look up post in the help! I think it is like this:
> Post(Event:Accepted, Glo:Win1Thread, Glo:Win1Button)
> but I might have the wrong order of the thread and controlnumber
> parameters!?
>
> Before posting you should check that win1 is open. For example by
> checking that Glo:Win1Thread <> 0. If you use this check, remember to
> Clear(Glo:Win1Thread) when killing win1.
>
> Tell me if this works out. Otherwise I might get time to make a little
> example tomorrow at work.
>
> Best regards
>
> Kasper
| |
| bob tanujaya 2004-10-05, 8:55 am |
| Hi KGC
it runs and work fine, thank so much for helping to solve the problem,
you don't need to spend time to make a little example anymore.
thank.
best rgds. Bob Tanujaya
kgc <news1@kaspershjemmeside.dk> wrote in message news:<416245a1$0$265$edfadb0f@dread12.news.tele.dk>...
> Hi
> I can try - but since I haven't clarion installed at home (only at
> work), I'm not sure if I can remeber everything correctly - but if I
> doesn't suceed, I can look it up at work tomorrow. Your steps aren't
> that wrong. But here goes:
>
> When you have the Glo:Win1Thread variable, you doesn't need the
> window-reference too (threadnumber or window-reference is enough), but
> you shold have a "reference" to the button ie. the control-number of the
> button. So instead of Glo:Win1Ref you could have Glo:Win1Button (I think
> type should be Long, but I'm not 100% sure). The type of Glo:Win1Thread
> should be the same as the returntype og Thread() - I think that is Long,
> but check the help (most possibly it will work with byte, since the
> threadnumber isn't that big - but use the correct type just to be sure)
>
> Glo:Win1Thread = Thread() is fine (case doesn't mattter). You shold also
> put Glo:Win1Button = ?Button1 (the label "?Button1" is just a
> placeholder for the internal "controlnumber")
>
> The use-field just specifies the name of the button. Leave it as
> ?Button1 - the control-number is automaically assigned by clarion.
>
> OK, check that this is still so.
>
> Look up post in the help! I think it is like this:
> Post(Event:Accepted, Glo:Win1Thread, Glo:Win1Button)
> but I might have the wrong order of the thread and controlnumber
> parameters!?
>
> Before posting you should check that win1 is open. For example by
> checking that Glo:Win1Thread <> 0. If you use this check, remember to
> Clear(Glo:Win1Thread) when killing win1.
>
> Tell me if this works out. Otherwise I might get time to make a little
> example tomorrow at work.
>
> Best regards
>
> Kasper
|
|
|
|
|