Search found 4910 matches

by RASHAD
Thu Jan 08, 2026 5:13 pm
Forum: Coding Questions
Topic: Is there a #PB_Event_KeyDown ?
Replies: 8
Views: 270

Re: Is there a #PB_Event_KeyDown ?

Simple key checker

OpenWindow(0, 0, 0,300,40, "", #PB_Window_MinimizeGadget|#PB_Window_ScreenCentered)
TextGadget(0, 0, 8, 300, 20, "Press any key.", #PB_Text_Center)

Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1

Case #WM_CHAR ;Char / Ctrl + Char
key = EventwParam ...
by RASHAD
Thu Jan 08, 2026 5:08 pm
Forum: Coding Questions
Topic: Is there a #PB_Event_KeyDown ?
Replies: 8
Views: 270

Re: Is there a #PB_Event_KeyDown ?

You are a Windows user
So if you want to get any key pressed and any key combination with (alt-ctrl-shift)
You can use Local Hook
by RASHAD
Thu Jan 08, 2026 4:14 pm
Forum: Bugs - Windows
Topic: FrameContainer Font Text!
Replies: 6
Views: 301

Re: FrameContainer Font Text!

Hi ChrisR
I don't like it but if you insist :)

If OpenWindow(0, 0, 0, 500, 220, "FrameContainer Font Text", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
LoadFont(0, "Segoe UI", 12, #PB_Font_Italic)
SetGadgetFont(#PB_Default, FontID(0))
FrameGadget(0, 20, 60, 200, 120, "FrameContainer_0 ...
by RASHAD
Thu Jan 08, 2026 4:30 am
Forum: Coding Questions
Topic: CreateMenu shortcut does not work
Replies: 5
Views: 163

Re: CreateMenu shortcut does not work

Hi

;
; ------------------------------------------------------------
;
; PureBasic - Menu example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;

;
; We just have to open a window and see when an event happen on the menu
;

If OpenWindow(0, 100 ...
by RASHAD
Thu Jan 08, 2026 2:26 am
Forum: Coding Questions
Topic: CreateMenu shortcut does not work
Replies: 5
Views: 163

Re: CreateMenu shortcut does not work

Wake up :D

;
; ------------------------------------------------------------
;
; PureBasic - Menu example file
;
; (c) Fantaisie Software
;
; ------------------------------------------------------------
;

;
; We just have to open a window and see when an event happen on the menu
;

If OpenWindow ...
by RASHAD
Fri Jan 02, 2026 10:46 pm
Forum: Coding Questions
Topic: Editor - once again about word wrap
Replies: 2
Views: 180

Re: Editor - once again about word wrap

Maybe

Global oldprocedure

Procedure editorGadgetCB(hwnd, uMsg, wParam, lParam)
If uMsg = #WM_CHAR
If wParam <> #VK_BACK
If Len(GetGadgetText(0))%30 = 29
keybd_event_(#VK_RETURN,0,0,0)
keybd_event_(#VK_RETURN,0,#KEYEVENTF_KEYUP,0)
EndIf
EndIf

EndIf
ProcedureReturn CallWindowProc ...
by RASHAD
Sun Dec 21, 2025 5:02 am
Forum: Coding Questions
Topic: Hide Mouse
Replies: 3
Views: 246

Re: Hide Mouse

Try

CreateImage(0, 32,32)
CreateImage(1, 32,32)

StartDrawing(ImageOutput(0))
Box(0,0,32,32,#White)
StopDrawing()

icoInf.ICONINFO
icoInf\fIcon = #False
icoInf\hbmMask = ImageID(0)
icoInf\hbmColor = ImageID(1)

curHnd = CreateIconIndirect_(icoInf)
;
For x = 32512 To 32650 ;Hide System cursor ...
by RASHAD
Thu Dec 18, 2025 3:03 pm
Forum: Coding Questions
Topic: Loops in floats
Replies: 7
Views: 547

Re: Loops in floats

Hi
Try

Code: Select all

Define a.f
Repeat
  Debug a
  a.f+0.04 
Until a => 50

Code: Select all

Define a.f
While a < 50.04
  Debug a
  a.f+0.04 
Wend
by RASHAD
Wed Dec 10, 2025 3:53 pm
Forum: Coding Questions
Topic: Best workaround for SetMenuItemState?
Replies: 6
Views: 643

Re: Best workaround for SetMenuItemState?

Hi dige
Quick hack adapt it for your needs
Use state? to set the menu item status
SetMenuItemBitmaps_() = SetMenuItemState :D


UsePNGImageDecoder()
LoadImage(1,#PB_Compiler_Home + "examples/sources/Data/ToolBar/Open.png")
LoadImage(2,#PB_Compiler_Home + "examples/sources/Data/ToolBar/Save.png ...
by RASHAD
Tue Dec 09, 2025 6:15 pm
Forum: Coding Questions
Topic: [SOLVED] Switch mouse cursor from arrow to hand
Replies: 4
Views: 486

Re: Switch mouse cursor from arrow to hand


If InitSprite() = #Null
MessageRequester("Error", "InitSprite failed.", #PB_MessageRequester_Error)
End
EndIf

#_WINDOW_WIDTH = 720
#_WINDOW_HEIGHT = 640
OpenWindow(0, 0, 0, #_WINDOW_WIDTH, #_WINDOW_HEIGHT, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
OpenWindowedScreen(WindowID(0), 0 ...
by RASHAD
Sat Dec 06, 2025 4:38 pm
Forum: Coding Questions
Topic: [SOLVED] Reliable #WM_MOUSEWHEEL value?
Replies: 12
Views: 724

Re: Reliable #WM_MOUSEWHEEL value?

Hi
You can try
Windows x64

Code: Select all

  If Message = #WM_MOUSEWHEEL
    value = wParam >> 24
    If value = 0
      Debug "up"
    ElseIf value = 255
      Debug "down"
    EndIf
  EndIf
by RASHAD
Fri Nov 28, 2025 11:47 am
Forum: Coding Questions
Topic: vectordrawing and font offset, bigdifferences
Replies: 1
Views: 428

Re: vectordrawing and font offset, bigdifferences

Hi Mesa
I think your approach to get the default font is not quit right

If OpenWindow(0, 0, 0, 400, 200, "VectorDrawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, 400, 200)

; FID = GetGadgetFont(#PB_Default)
; fnt.LOGFONT
; GetObject_(FID,SizeOf(fnt),@fnt ...
by RASHAD
Wed Nov 26, 2025 9:03 am
Forum: Coding Questions
Topic: [RESOLVED] Ai's Grok and ChatGPT cannot fix non-displaying Graph
Replies: 7
Views: 887

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Just replace

; -------------------------------------------------
; MAIN
; -------------------------------------------------
If OpenWindow(#Window, 0, 0, 900, 600, "PureBasic XY Graph - FIXED",
#PB_Window_SystemMenu | #PB_Window_ScreenCentered | #PB_Window_SizeGadget)

CanvasGadget(#Canvas, 0, 0 ...
by RASHAD
Wed Nov 26, 2025 7:19 am
Forum: Coding Questions
Topic: [RESOLVED] Ai's Grok and ChatGPT cannot fix non-displaying Graph
Replies: 7
Views: 887

Re: Ai's Grok and ChatGPT cannot fix non-displaying Graph

Hi VB6_to_PBx
Long time no see

Enumeration
#Window
#Canvas
EndEnumeration

; -------------------------------------------------
; Data
; -------------------------------------------------
Global Dim DataX.f(8)
Global Dim DataY.f(8)

DataX(0) = 0.200 : DataY(0) = 151.1
DataX(1) = 0.300 : DataY(1 ...
by RASHAD
Wed Nov 26, 2025 1:49 am
Forum: Coding Questions
Topic: Setting a Child Window into Parent
Replies: 11
Views: 1211

Re: Setting a Child Window into Parent

PB ParentID is like Windows API #GWL_HWNDPARENT
It only keeps the child window over the parent window not as exact child
You can try restrict the child window moving
Next is just to show what I mean


;EnableExplicit
Define wndFlags
Define x,y,w,h

Enumeration Windows
#wnd_Main
#wnd_Child1 ...