PDA

View Full Version : Deleting Controls



catventure
06-11-2005, 16:52
Hi,

Does anybody know the correct syntax for using the "control kill" command when deleting controls from a dialog window?
Thanks,

catventure

Petr Schreiber
06-11-2005, 17:13
Hi Catventure,

Use of CONTROL KILL is very easy :


CONTROL KILL handleOfDialog, CtrlID


... so, if you created control like that :



CONTROL ADD BUTTON, hDlg, %ID_MYBUTTON, "Press me", 5, 5, 60, 15


You can simply kill it by :


CONTROL KILL hDlg, %ID_MYBUTTON


Hope it helps,
Psch

catventure
06-11-2005, 18:48
Hi Psch,

Ah I see. Yes it easy, especially when you have several controls numbered numerically to delete eg:

for i=1 to 10
control kill hdlg,i
next

Now I want to ask are there commands to enable/disable (grey out) controls as well?

Here's hoping ;)
catventure

ErosOlmi
06-11-2005, 18:55
Give me some little time and I will add ...

ErosOlmi
06-11-2005, 19:21
Psch, thanks for your support, appreciated.

Catventure, I've added CONTROL ENABLE and CONTROL DISABLE in updated version 1.0.6.4
Please pay attention: I've changed MsgBox. Now it as a new first parameter: hParent. hParent is the dialog handle of the window that you want MsgBox be dependant. This will block users to continue working if a dependant MsgBox is shown on screen until user confirm MsgBox

Eros

catventure
07-11-2005, 02:12
Wow,

Eros, that's incredibly fast! Are you superhuman? :)
I've d/loaded it and control enable/disable works good. Thank you for that and also the very speedy update! Amazing. The support here is fantastically good.

I hope you don't mind me asking these questions. I seem to be asking a few just lately...

Do you happen to know if there is a flagstyle parameter for setting/restricting a textbox (one-liner) to only accept numeric input? This would be handy when number data only is required and would save making code to check for that after 'getting' the contents of such control.

I'm writing a little dialog example but I've noticed that when/if I press <RETURN> key a set of controls shown by a function called by a dialog button on my dialog window disappear... the <RETURN> keypress seems to mimic my EXIT button which is the only control supposed to delete these controls...
Do you think I need to add a param to my dialog window or the individual controls to prevent this occurring? If so, what? Thank you.

I will try and solve and if no joy will post code tomorrow.

Goodnight,
catventure.


PS. Unless i'm mistaken I noticed a MSGBOX line in the RAS example that does not contain the new first parameter. Thought you'd like to know.

ErosOlmi
07-11-2005, 08:43
Hi catventure,

we try to do our best when we can. Expect also some "low" point ;)

Sorry, I'm in hurry right now but, if I'm not wrong equate is %ES_NUMBER to be used in style option.

Regarding Return, I should see a piece of code. Usually Return confirm the default button, like clicking on the default button but depending on the code it can be something else. Can you please post a piece of code?

I will fix RAS script.

Thanks
Eros

catventure
07-11-2005, 13:40
Hi,

Psch: I liked your new textbox example. Nice.

Eros: Yes %ES_NUMBER did the trick. Thought I'd tried it already but must have made a mistake.
Works OK.

Attached is file 'adventure'.

I'm playing around with Dialog Window, controls and functions for my adventure project.
Run it and click on the 'Location' button. Controls appear in the right of dialog window.
Strangely these controls disappear if <RETURN> pressed when some of the controls have focus.
This should only happen when the 'Exit' button is clicked.
It doesn't happen in the large textbox which is as it should be (added a %ES_WANTRETURN for that)

Cheers,
catventure.

ErosOlmi
07-11-2005, 16:13
Hi catventure,

I'm checking in spare time you script.
I do not see any error in it (apart new syntax for MsgBox) so I'm not able to understand why the strange behave. I need to read some Microsoft doc and see why Exit button is defaulted when cursor goes inside a textbox.

I will let you know.
Eros

ErosOlmi
07-11-2005, 16:55
Hi again catventure.

I think to have found the problem.
You have created buttons with %ES_CENTER while the correct equate for centering buttons is %BS_CENTER or even avoid %BS_CENTER because it is default inside buttons.

%ES_CENTER is for TEXTBOX and unfortunatelly is has the same value of %BS_DEFAULT so all buttons where defaulted. This was creating some strange behave.

See attached amended example.

I think these problems will be more easy to be solved once I will have finish documentations on this area. Equates are many and very similar.
I hope to have help file ready by the end of this week.

Ciao
Eros

catventure
07-11-2005, 19:07
Eros,

Your solution works. Thank you for pinpointing my mistake.
'Control Set Focus' produces an error though...
When I remmed those 2 lines that contained it - worked alright with out error.
Have you updated the preview again?
I really would like to use control set focus.

Cheers again,
catventure

ErosOlmi
07-11-2005, 19:16
Sorry, :oops:

While I was making help file, I've introduced CONTROL SET FOCUS, CONTROL GET SIZE and CONTROL GET CLIENT because I forget to add them.

I will update thinBasic this night.

So, just delete the lines.

Good.
Eros

Petr Schreiber
07-11-2005, 20:38
Catventure !,

your adventure project looks really impressive.
I like your dialog design too. I don't understand meaning of some controls, but I'll study it more.

To Eros : Although I have downloaded latest thinBASIC, I'm getting error in the corrected sample ( %BS_DEFPUSHBUTTON - unknown ).

If I declare it regarding to API as %BS_DEFPUSHBUTTON = &H1&, it's all OK.

Psch

ErosOlmi
07-11-2005, 20:53
Yes, it is part of the addition I did today in order to test catventure problem. Just delete it or use %BN_DEFAULT or wait till I will update 1.0.6.4 late this night.

Sorry but these are the pro and cons of an ongoing version ;)

Eros

Petr Schreiber
07-11-2005, 21:21
Please no apologies !,

I like the "ongoing" development idea, please continue :D

Psch

ErosOlmi
08-11-2005, 01:01
:lol:

version 1.0.6.4 updated with all new features.
Now I will work on help file.

Cheers
Eros

catventure
08-11-2005, 02:10
Bravo!

Downloading already as i write this :)

Thanks,
catventure.