View Full Version : You rate better than 4 stars
Wow, what a large site!
I am still getting my feet wet. I created a couple of canvas windows. I was experimenting with setfocus and getfocus, and am probably not using them correctly. But I thought you might appreciate some comments:
1) The statement "k1 = Win_GetFocus()" gives a misleading error: says "token found: k1" when actually maybe the ()'s shouldn't be there.
2) Win_GetFocus always gives 0. Am I missing something?
3) The debugger is great, but gives an error when I hit the "stop" button. No big deal.
4) When I copy code from MSWord into thinAir, I get double spacing. Also no big deal.
5) Ctl-V doesn't work from the Help. (Right-click/copy does work.)
Uses "Console", "ui"
Dim hwnd, k1 As Long
hwnd = Canvas_Window("Test", 100, 100, 400, 300)
Canvas_Attach(hwnd, 0, %FALSE)
Win_SetFocus(hwnd)
k1 = func1
k1 = func1() ' ()s no problem here
k1 = Win_GetFocus
k1 = Win_GetFocus() ' this gives misleading error? "token found: k1"
MsgBox 0, k1
Function func1() As Long
Function = 1
End Function
This is all small stuff. I am really impressed with TB. Thanks, Art
Petr Schreiber
28-06-2011, 08:14
Hi AMark,
welcome to the world of ThinBASIC :)
Ad 1)
When you move cursor on Win_GetFocus and press F1, ThinAIR will take you to the help file, where the documented syntax is without the (). Maybe it would be better if the () case could be handled the same way for user functions and module functions in future?
Ad 3)
If you read the "Error Description" field in the window you see after pressing Stop button, you will read:
Script execution aborted by user during a TRACE operation
... so it is by design.
Ad 5)
It works okay for me, do you use the latest ThinBASIC 1.8.8.0 release?
I am sure the other will be able to answer your other questions and I hope you will enjoy using ThinBASIC as much as I do!
Petr
ErosOlmi
28-06-2011, 11:02
Hi AMark and welcome to thinBasic community forum.
Here my replies:
Sorry, my mistake. I usually create keywords where is optional to indicate () (so programmer can set or not them) but in this case I made a mistake. I will fix asap
All Win_* thinBasic functions are wrappers of some windows API. I did that in order to avoid to declare most of the frequently used APIs
Win_Getfocus is a wrapper of windows API Getfocus documented here: http://msdn.microsoft.com/en-us/library/ms646294(v=vs.85).aspx
Its main purpose is to get the window handler of the window having the keyboard focus. But what window? Anything in Microsoft OS is a window: a textbox, a button, a listbox. All are windows. Win_Getfocus return the handle of the window having the cursor over it. Your canvas window has no textboxes or buttons or any other controls that can get the keyboard focus.
To get the main window having the focus, better to use Win_GetForegroundWindow (http://www.thinbasic.com/public/products/thinBasic/help/html/win_getforegroundwindow.htm) that is a wrapper of GetForegroundWindow described here: http://msdn.microsoft.com/en-us/library/ms633505(v=vs.85).aspx
Yes, it is by design generating a sort of fake run time error whose description is clear (to me) but someone already bring it to my attention that because it is identical to a real run time error it can create confusion. I will change it.
be sure to have latest thinBasic version. Currently it is 1.8.8.0. Check link present on top of all forum pages
same as 4.
Ciao
Eros
I had TB 1.8.6.0 -- 1.8.8.0 does fix those 2 things.
And you have answered the other questions. Thank you.
The "4-star" site is
http://basic.mindteq.com/index.php?option=com_content&view=article&id=118%3Athinbasic&catid=40%3Areviews&Itemid=11
which needs to be updated to 5 stars. TB is wonderful!
The contextual help is great!
I do a lot with MSWord and MSExcel VBA, and use
IF condition THEN dotrue ELSE dofalse
which I see is not allowable.
It would be nice to flag that as an error.
Uses "Console"
'The following statement seems to ruin the whole script.
'If TRUE Then PrintL "T1" Else PrintL "F1"
'The following statement doesn't print "F2"
If FALSE Then PrintL "T2" Else PrintL "F2"
'I know that the following is how it should be done.
If TRUE Then
PrintL "T3"
Else
PrintL "F3"
End If
If FALSE Then
PrintL "T4"
Else
PrintL "F4"
End If
Console_WaitKey
I hit "Edit 'About Me'" and got to
http://www.thinbasic.com/community/member.php?1351-AMark&tab=aboutme
but I don't see how to change anything. I'm in Denver, Colorado
But I'm not going to be around much for awhile.
Thanks and best wishes, Art
ErosOlmi
29-06-2011, 20:59
I hit "Edit 'About Me'" and got to
http://www.thinbasic.com/community/member.php?1351-AMark&tab=aboutme
but I don't see how to change anything. I'm in Denver, Colorado
From top menu search sub menu "Forum actions" and choose "Edit profile"
Ciao
Eros
ErosOlmi
29-06-2011, 21:02
I do a lot with MSWord and MSExcel VBA, and use
IF condition THEN dotrue ELSE dofalse
which I see is not allowable.
It would be nice to flag that as an error.
Uses "Console"
'The following statement seems to ruin the whole script.
'If TRUE Then PrintL "T1" Else PrintL "F1"
'The following statement doesn't print "F2"
If FALSE Then PrintL "T2" Else PrintL "F2"
'I know that the following is how it should be done.
If TRUE Then
PrintL "T3"
Else
PrintL "F3"
End If
If FALSE Then
PrintL "T4"
Else
PrintL "F4"
End If
Console_WaitKey
Created support bug issue: http://www.thinbasic.com/community/project.php?issueid=296
(http://www.thinbasic.com/community/project.php?issueid=296)
Great. And Thanks again. Art