When I choose PureBasic in order to make cross platform applications I was aware of some portability issues. I know that if I want the same code running under diferent OS I shall not use specific API calls and avoid any library that doesn't work in both systems. That is not a dificult task becouse the compatibility of functions are all stated at PB documentation and I really do not plan to call specific OS API. If PB is as fast as I think it is, I'll not need those calls
I'm testing a full registered version of PB for a couple of weeks and I'm stubbed with a thing I thought should be a simple task. I'm trying to inspect Events comming from a Window. As I said before, I know that the message ID returned for each event might be different under Windows and Linux. The piece of code that follows works fine under WinXP, but does not under Red Hat 8 (I picked a GNU/Linux distro from the tested versions stated at PB Linux Documentation).
I already post something about it at the Beginners forum, but I think the post was misunderstood. The main problem is not related with the way text is displayed, despite of the fact Locate() function seems do not work properly. The first call to Locate() works fine, but the secont does not. Freaky
As a Linux newbie, I can't tell if it is a problem within the distro I choose for or if it is a real PB bug, so I'm posting here and I hope somebody can drop some light at my questions :roll:
Well... the main goal of the code below was to inspect message IDs sent by the system to the window itself. As I could perceive, I can compare the events returned by WaitWindowEvent() with the PB constants (since the CloseWindow Event is working fine), but I could not print them or manage them someway different. Why? Am I doing something wrong? Are events not catch by WaitWindowEvent() in the form of a numeric code that can be held by a Long type variable? Can I print out those values (properly converting them to a string before printing)?
I'm programming Basic-Like languages since a long time ago. Indeed, I've never asked for help on a forum, and I'm very shamed about doing it now, but I have no other way to solve this questions quickly.
I hope some of you can give me some aid on that issue. Indeed, I'll be grateful for any clue. Thanks in advance...
Derlidio
Code: Select all
OpenWindow(0, 0, 0, 320, 200, #PB_Window_SystemMenu|#PB_Window_SizeGadget, "Testing, 1, 2, 3...")
Repeat
E = WaitWindowEvent()
If E <> #PB_Event_CloseWindow
X = X + 1
StartDrawing(WindowOutput())
FrontColor(0,0,0)
BackColor(255,255,255)
Locate(40,50): DrawText("Event: " + StrU(E,#Long) + " Event Count: " + Str(X))
Locate(40,80): DrawText("Event: " + StrU(E,#Long) + " Event Count: " + Str(X))
StopDrawing()
Else
MessageRequester("Bye Bye", "Leaving...")
Break
EndIf
ForEver
End