How to make this button work, please?

Hi!

This code gives me a button that "depresses" when I click on it but does not evidence a control deselected.

I just now added the count exit in case someone wanted to try it; I have no idea how big a count should be tried. I had ct < 1000 and button-clicked a couple dozen times without getting the control deselected message. (1000 may be too little with 0 wait time in TC_EVENT.)

I have been using no count and using windows task manager to get out of the program.

So, please, how to make this button work? I have had equal problems with radio group buttons and list buttons.

Thanks!

program tsatest

LIBRARY "c:\program files (x86)\tbsilver\tblibs\truectrl.trc"
call TC_INIT

call TC_WIN_CREATE(btns,"title",.20, .50,.18, .313)
call TC_SHOW(btns)
call TC_WIN_SETFONT(btns,"Helvetica",10,"BOLD")
call TC_WIN_SETTITLE(btns,"Scroll/Edit/Search Control Window (no click = continue)")

call TC_WIN_ACTIVE(btns)

call TC_PushBtn_Create(pb1, "Main Menu", .01, .31, .76, .99)

let q$ = "?"
let ct = 0
do while q$ = "?" and ct < 1000
call TC_EVENT(0, event$, wn, x1, id)
if event$ <> "control deselected" then
let q$ = "?"
else
input prompt "control deselected!!!": q$
end if
let ct = ct + 1
loop

call TC_cleanup

end

Comments

PUSH BUTTONS

Hi,

Try using a much simpler loop:

do ! while q$ = "?" and ct < 1000
call TC_EVENT(0, event$, wn, x1, id)
IF event$="HIDE" then EXIT DO ! when you close the window
if event$ <> "control deselected" then
let q$ = "?"
elseif event$="CONTROL DESELECTED" then ! when the button is pressed
print "got here"
!input prompt "control deselected!!!": q$
end if
!let ct = ct + 1
loop

THE REAL PROBLEM, IT TURNS OUT

Thanks, yet I was pessimistic about your suggestion(s).

The HIDE bit was to give me an out IFF the whole thing was working.

The elseif structure would only help if nested IFs wouldn't work in some cases, which didn't seem likely.

And yes, it didn't work; your example didn't work.

Why? Because the base IF had a small-letters "control deselected".

The manual doesn't say you have to use caps (p 187) but that is how it is (so the base IF of 'our' trials is always true, avoiding the 'found' output.).

So, no signal (response) is a signal?

I note y'all sometimes just let sit posts that pose questions you think have obvious answers in the $70+print job manual's pages.

Well, I have pounded the COBOL out of the manual and do not see the answer, so please chip in, someone.

Thanks.

More information

Was this code you were writing in v.5x or in v6? You have posted this in the 5.x forum and it's likely that with the flurry of activity with 6.0 it's been overlooked.

It's also possible that the issue is caused by a v6 bug which is currently being resolved.

hmmm

Thanks.

v5, the upgrade I bought a month ago for windows 7.