PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Adding/removing properties on controls.

Though I have programmed for a while, I feel like a newbie sometimes :-(

My question is, in PPL, how do you change (add/remove) the properties to a non-activeX control like a groupbox? Things like WS_VISIBLE etc.
Just bring up the form, make sure the style tab is selected in the property area to the right, find the style you want to change in the list and tap on it. The highlighting should change to a colored background to let you know that it is now active. Tap selected styles to make them inactive.

That's it.

bmanske
God bless you BManske! HAHAHAHA, my bad, I should have been more specific. That wasn't what I was trying to ask. Hopefully I'm not THAT bad of a programmer :oops:

I meant, how do I do it with code, For instance, I click on a button, and it makes a groupbox visible. etc.

Thanks again
A-Ha! Code to show a window...

How about:

ShowWindow(WindowHandle$, SW_SHOW); or SW_HIDE to hide it

HAHAHAHA! :lol: go ahead and bless me again. I never turn down a blessing!

I should probably mention that adjusting some properties like enabling / disabling the window uses commands like EnableWindow. Other styles require more arcane functions like SetWindowLong.

Hope this helps.

bmanske
Ok,
I thought there was a function like in the GameAPI where you added and removed those options from the control like AddControlOptions(Control ID, WS_VISIBLE|WS_ENABLED). I will use ShowWindow.

a few more questions if you can:

1)So how would I do something like add ES_PASSWORD or remove ES_MULTILINE. Stuff like that.

2) is there something that will return the handle of the control by using, say, the ID of that control?

3)Lastly, where do you catch the event for, say a editbox's DblClick, or Change event? Do you doubleclick the Editbox control then use the WM_DblClick event in the EditBoxProc()?
#1 Changing these styles requires the use of SetWindowLong. Check with MSDN to be sure.

#2 I think you are looking for GetDlgItem

Code:
ControlHandle$ = GetDlgItem(DialogHandle$, ControlID$);


#3 Yes, you catch the events in the event handler for the edit control.

This is a little like watching a cook. I see the ingrediants, but what is being cooked?... no one knows. I'll catch up again with you tomorrow to see what's cookin.

bmanske
So I created a textbox(editbox) and doulble click on it to bring up EditBoxProc() and I want to catch the WM_CHANGE event so I put:

Code:
func btnTestProc (hWnd$, Msg$, wParam$, lParam$)
local(ok$);
ok$ = true;
case (Msg$)
WM_COMMAND:
local(wmId$, wmEvent$);
wmId$ = LOWORD(wParam$);
wmEvent$ = HIWORD(wParam$);
case (wmEvent$)
WM_CHANGE:
end;
// Put your code here
end;
return (ok$);
end;

However, I get an syntax error with WM_CHANGE or anyother event. What am I doing wrong?

Also, I tried SetWindowLong() but PPL gives me an error and won't let me use it
mmtbb,

The first problem that I see is that there is no WM_CHANGE. What I think you are looking for is EN_CHANGE which is the Edit Notification you get after a change has been made and the screen is updated.

Make that small change to your example and it should work. You said other messages didn't work? Let me know if you have examples of others that don't work.

I haven't tried setWindowLong myself. It could be that there is some kind of problem. I'll try a quick test.

bmanske
boy, I am happy to hear from you. I have been getting more and more frustrated trying to program controls.

Examples of other events that give errors are WM_CLICK and WM_DBLCLICK if placed in the same spot.

I come from a world of Visual programming where I place a textbox on a form and easily select any event for that control. I can then add my code to the event. Most textboxes have a Change, Click, DblClick, KeyPress, KeyDown, KeyUp etc. Events. Example:

Private MyTextBox_DblClick()
//Place code here
end;

I feel like I can't do even the simple things that I used to do so easy.

PS. I just tried EN_CHANGE, and nothing happens when the textbox changes
mmttb: I don't think you should play with the Windows API. You are not used to it and it looks too complicated for you.

Wait for PPL v1.0 it's got a better event handling system.

proc MyButtonClick (...)
end;

In v1.0 you just double-click the event you want to edit put the code and thats it.

It's not as simple as VB still but it's very close. Don't expect PPL to be another VB it's not the goal.
Kornalius,

It's not as simple as VB still but it's very close. Don't expect PPL to be another VB it's not the goal.


Actually, I don't expect another VB. I expect it to be BETTER than VB...In time. :D

Anyway, I always get frustrated, but THAT happens anytime I try to learn something new.

I want to understand the flow of the code in an event. I have always wondered what goes on behind the scene.
The good thing about PPL v1.0 is that you can code your forms with the standard Windows API or use the new event handling system.

I like your thinking, learning can be frustrating but at least you are trying to understand, that's what makes real artists. 8)

PPL will continue to evolve with time, that is my goal.
mmtbb,

So how is it going? Did you get beyond the part that was handing you up?

bmanske
I'll send a PM sometime tonight. Thanks
Thanks BManske and Kornalius.

Things are starting to come together.