Deleted!
[This message has been edited by Adam Ritchie (edited April 08, 2000).]
Announcement
Collapse
No announcement yet.
Pressing button or key
Collapse
X
-
Guest replied
-
-
Semen, I tried this code but it didn't work:
Code:callback function hdlg02cb select case cbmsg case %wm_keydown if cbwparam=%vk_f1 then textbox05("Key F1 Pressed") case %wm_destroy call deleteobject(hfont) call postquitmessage(0) end select end function
------------------
Leave a comment:
-
-
Guest repliedYou can use IsWindowEnabled to test the enabled state of a window, but I must question why you'd want to do this - it would be easier using a STATIC or GLOBAL variable in your code, which has the Handle or ID of the currently enabled button.
Another way if you want one button pressed at a time is to use Radio Buttons (Option buttons in VB) as that is much easier.
------------------
Kev G Peel
KGP Software
Bridgwater, UK.
mailto:[email protected][email protected]</A>
Leave a comment:
-
-
Semen, I tried your code and it worked. There is %WS_DISABLED but there is no %WS_ENABLED. I thought I would write the callback function like this:
callback function hdlg02cb
select case cbmsg
case %wm_char
if cbwparam=49 then control send hdlg02,100,%bm_click,0,0
if cbwparam=50 then control send hdlg02,101,%bm_click,0,0
if cbwparam=51 then control send hdlg02,102,%bm_click,0,0
case %wm_destroy
call postquitmessage(0)
end select
end function
But when I tried to press the "1" key, my computer beeped but nothing happened. Also, I have two callback functions for push buttons labeled "Exit". When I press one of the buttons, the program is supposed to exit but I can't put postquitmessage there because it is in the callback function hdlg02cb. Jeffrey.
------------------
Leave a comment:
-
-
Jeffrey --
I am also was (and is) VB programmer tooand don't know C.
I'm almost sure that at least 50% of PB customers use VB also.
So I exactly imagine your API's knowledge at this moment.
To write really big PB's apps is enough difficult.
But VB is fat and slowly. So, for "middle" apps PB is excellent tool.
I also have "Visual BASIC Programmer's Guide to the WIN32 API".
(now I understand that this is "empty" book).
As rule, Lance recommends Petzold's "Programming Windows" (for beginners) and Rector/Newcomer "Win32 Programming" (more detail description).
I have both (note, ordered in Amazon). Petzold's book is almost new. But I can't to say the same about Rector/Newcomer.
Unfortunatelly, even such fat books sometimes is not enough
------------------
Leave a comment:
-
-
Semen, Thanks for the code. Visual BASIC is different from PB/DLL because in Visual BASIC, you draw controls on forms and write code for controls. In PB/DLL, you have to write code to draw controls and write code for them almost the same way that you use C++ compiler to write code. I have "Programming Windows Fifth Edition" book written by Charles Petzold and "Visual BASIC Programmer's Guide to the WIN32 API" book written by Dan Appleman. There is another book on WIN32 API recommended by Lance but I forgot its title and I think that Amazon book store doesn't have it. Jeffrey.
------------------
Leave a comment:
-
-
Hello,
I'll just pass on the same favor I was given when I first showed up here... Do some reading
Check out the FAQ forum for some suggested books.
Colin Schmidt
------------------
Colin Schmidt & James Duffy, Praxis Enterprises, Canada
Leave a comment:
-
-
Jeffrey --
When you talk about PB, it's necessary to understand that it's possible to do ALL, because you can operate with "row" API.
Another question - comfortable or not, have you enough knowledge or not.
For example, you can test WS_DISABLED bit in window's style.
(there are also another ways)
Code:#Compile Exe #Register None #Dim All #Include "win32Api.inc" CallBack Function Cb Select Case CbMsg Case %WM_COMMAND If CbCtl = 101 Then If IsTrue(GetWindowLong(GetDlgItem(CbHndl, 102), %GWL_STYLE) And %WS_DISABLED) Then _ Control Enable CbHndl, 102 Else Control Disable CbHndl, 102 End If End Select End Function Function PbMain Local hdlg As Long Dialog New 0,"Test",,, 200, 70, %ws_sysmenu To hdlg Control Add Button, hdlg,101, "Disable/Enable Second Button", 10, 10, 180, 15 Control Add Button, hdlg,102, "Second Button", 10, 30, 180, 15 Dialog Show Modal hdlg Call Cb End Function
Leave a comment:
-
-
Adam, Thanks for helping me. In Visual BASIC, I can write code like this:
If char01$="1" and Command1.Enabled=True then Command1.Value=True
In PB/DLL, I would write code like this:
If char01$="1" then control send hdlg,100,%bm_click,0,0
but there is no function in PB/DLL that checks to see if a control is enabled before using control send. Jeffrey.
------------------
Leave a comment:
-
-
Jeffrey,
Why not download some of Dave Navaro's *.inc files from the ftp site? For example in Button32.inc you can find the following:-
'==============================================================================
'
' Button encapsulation for PB/DLL 5.0
' Copyright (c) 1997,98 by PowerBASIC, Inc.
'
' Notes:
'
' * Assumes that WIN32API.INC will also be included into your code.
' * Success = 0 if an operation is successful, otherwise a non-zero value
' is returned.
' * Many items marked as "Win95 only" will also work in WinNT 4.0 or later.
'
'==============================================================================
'------------------------------------------------------------------------------
' TITLE: BmClick
' DESC: Simulate the user clicking a button. This causes the button to
' receive a %WM_LBUTTONDOWN and a %WM_LBUTTONUP message, and the
' button's parent window to receive a %BN_CLICKED notification message.
' SYNTAX: BmClick hButton
'
SUB BmClick(BYVAL hButton AS LONG)
SendMessage hButton, %BM_CLICK, 0, 0
END SUB
These files are all great study material. You can then see how
the code may need changes to use ddt - Control send etc.
Regards,
David
------------------
Leave a comment:
-
-
Guest repliedDeleted!
[This message has been edited by Adam Ritchie (edited April 08, 2000).]
Leave a comment:
-
-
Pressing button or key
In Visual BASIC, I can use this code:
Command1.Value = True
to have the program "press" the button for me. I can't find similar code in PB/DLL to press a button or a key for me. Can you give me example code to press buttons and keys? Jeffrey.Tags: None
-
Leave a comment: