Main Menu

News:

SyntaxBoom, now with pwetty syntax highlighted code boxes! \o/ 

https://www.syntaxboom.com/forum/index.php?topic=96

Shoutbox

Baggey

2025-09-24, 17:57:11
They'll be using Expanding foam to glue bricks together next  :-X

Dabzy

2025-09-24, 06:09:52
You can also get the expanding foam post fix, but, I wouldnt trust it really, especially where I live on the side of a valley and when the storms blow in the right direction, whistling down the valley, nowt is safe!

Baggey

2025-09-23, 08:53:01
That Postcrete stuff is amazing. I never know how much water to add. May be i should read the Instructions  ;D 

Dabzy

2025-09-22, 21:33:46
Cannot beat a breaky uppy mode, saves the hand cramps and chipped knuckles knocking ten bells out of a chod of conc with a hammer and chisel.

GfK

2025-09-22, 21:28:44
I have a massive JCB drill with a concrete breaky uppy mode which has got me out of jail free a couple of times replacing rotted fence posts that has been concreted in.

Amon

2025-09-22, 19:23:30
What about Roly?

Dabzy

2025-09-22, 19:22:35
Putting my 2 deckings in.... I've dug enough post holes to last me a life time... I feel sorry for the future poor sod who may want to shift'em... Like most things I do, I tend to go over the top, and as such, I've probably got shares in postcrete! :D

GfK

2025-09-22, 19:10:57
Round is a shape.

Baggey

2025-09-22, 19:04:49
Consult a qualified electrician for compliance with BS 7671 and local building Regs! Avoid areas where future digging is likely. ;)

Jackdaw

2025-09-22, 18:18:24
That depends on where the cable is to run. Minimum depth in a garden in 450mm. Under pavements 600mm.

Members
  • Total Members: 55
  • Latest: Amon
Stats
  • Total Posts: 1,607
  • Total Topics: 198
  • Online today: 12
  • Online ever: 54 (Sep 14, 2025, 08:48 AM)
Users Online
  • Users: 0
  • Guests: 7
  • Total: 7
Welcome to SyntaxBoom. Please login or sign up.

Recent

MaxGUI - GadgetPrint()

Started by _PJ_, Sep 25, 2025, 01:50 PM

Previous topic - Next topic

_PJ_


GadgetPrint(  )
Does not seem to do anything:

Import maxgui.drivers
Local window:Tgadget=CreateWindow("Test",0,0,256,64)
Local gadget:Tgadget=CreateTextArea(0,0,128,16,window)
SetGadgetText(gadget,"testing")
GadgetPrint(gadget)

Does anyone else have issues?

Henri

Hi,

all functionality in DoPrint method has been commented out (not sure why). If you want that functionality back, you have to make few modifications.

In 'maxgui.mod\win32maxguiex.mod\win32maxguiex.bmx' find line 4216, and add this inside Method DoPrint()

Local tmpTextSelLen = TextAreaSelLen(Self)
Local tmpPrintDialog:PRINTDLGW = New PRINTDLGW

tmpPrintDialog.flags = PD_RETURNDC | PD_HIDEPRINTTOFILE | PD_NOPAGENUMS
If Not tmpTextSelLen Then tmpPrintDialog.flags:|PD_NOSELECTION

tmpPrintDialog.hwndOwner = _hwnd

If Not PrintDlg( Byte Ptr tmpPrintDialog ) Then Return 0

Local hdcPrinter:Byte Ptr = tmpPrintDialog.hdc

Local tmpDoc:DOCINFOW = New DOCINFOW
Local tmpDocTitle:Short Ptr = AppTitle.ToWString()
tmpDoc.lpszDocName = tmpDocTitle

Local tmpSuccess = (StartDocW( hdcPrinter, Byte Ptr tmpDoc ) > 0)

If tmpSuccess Then

	Local _cursor:Byte Ptr = TWindowsGUIDriver._cursor

	SetPointer( POINTER_WAIT )

	SetMapMode( hdcPrinter, MM_TEXT )

	Local wPage = GetDeviceCaps( hdcPrinter, PHYSICALWIDTH )
	Local hPage = GetDeviceCaps( hdcPrinter, PHYSICALHEIGHT )
	Local xPPI = GetDeviceCaps( hdcPrinter, LOGPIXELSX )
	Local yPPI = GetDeviceCaps( hdcPrinter, LOGPIXELSY )

	Local tmpTextLengthStruct[] = [GTL_DEFAULT,1200]
	Local tmpTextLength = SendMessageW (_hwnd, EM_GETTEXTLENGTHEX, WParam Byte Ptr tmpTextLengthStruct, 0)

	Local tmpTextPrinted, tmpFormatRange:FORMATRANGE = New FORMATRANGE

	tmpFormatRange.hdc = hdcPrinter
	tmpFormatRange.hdcTarget = hdcPrinter

	tmpFormatRange.rcPageRight = (wPage*1440:Long)/xPPI
	tmpFormatRange.rcPageBottom = (hPage*1440:Long)/yPPI

	tmpFormatRange.rcLeft = (1440*_pagemargin);tmpFormatRange.rcTop = (1440*_pagemargin)
	tmpFormatRange.rcRight = tmpFormatRange.rcPageRight - (2880*_pagemargin)
	tmpFormatRange.rcBottom = tmpFormatRange.rcPageBottom - (2880*_pagemargin)

	If tmpPrintDialog.flags & PD_SELECTION Then
		tmpTextPrinted = TextAreaCursor(Self)
		tmpFormatRange.CHARRANGE_cpMax = tmpTextPrinted+tmpTextSelLen
	Else
		tmpFormatRange.CHARRANGE_cpMax = tmpTextLength
	EndIf

	SendMessageW (_hwnd, EM_FORMATRANGE, False, 0)

	While tmpSuccess And ( tmpTextPrinted < tmpFormatRange.CHARRANGE_cpMax )

		tmpFormatRange.CHARRANGE_cpMin = tmpTextPrinted

		tmpSuccess = (StartPage(hdcPrinter) > 0)
		If Not tmpSuccess Then Exit

		tmpTextPrinted = SendMessageW( _hwnd, EM_FORMATRANGE, True, Int Byte Ptr tmpFormatRange )

		tmpSuccess = (EndPage(hdcPrinter) > 0)

	Wend

	If tmpSuccess Then EndDoc( hdcPrinter ) Else AbortDoc( hdcPrinter )

	SendMessageW (_hwnd, EM_FORMATRANGE, False, 0)

	TWindowsGUIDriver._cursor = _cursor
	SetCursor _cursor

EndIf

GlobalFree( tmpPrintDialog.hDevMode )
GlobalFree( tmpPrintDialog.hDevNames )
DeleteDC( hdcPrinter )

MemFree tmpDocTitle

Return tmpSuccess


In 'C:\BlitzMaxNG\mod\maxgui.mod\win32maxguiex.mod\common.bmx' add these definitions:

Const PD_NOSELECTION:Int = $4
Const PD_DISABLEPRINTTOFILE:Int = $80000
Const PD_PRINTTOFILE:Int = $20
Const PD_RETURNDC:Int = $100
Const PD_RETURNDEFAULT:Int = $400
Const PD_RETURNIC:Int = $200
Const PD_SELECTION:Int = $1
Const PD_SHOWHELP:Int = $800
Const PD_NOPAGENUMS:Int = $8
Const PD_PAGENUMS:Int = $2
Const PD_ALLPAGES:Int = $0
Const PD_COLLATE:Int = $10
Const PD_HIDEPRINTTOFILE:Int = $100000

Type PRINTDLGW
	Field lStructSize:Int = SizeOf(Self)
	Field hwndOwner:Byte Ptr, hDevMode:Byte Ptr, hDevNames:Byte Ptr, hdc:Byte Ptr
	Field flags:Int, nFromPage:Short, nToPage:Short, nMinPage:Short, nMaxPage:Short, nCopies:Short
	Field padding:Short, padding2:Short, padding3:Short, padding4:Short, padding5:Short, padding6:Short
	Field padding7:Short, padding8:Short, padding9:Short, padding10:Short, padding11:Short, padding12:Short
	Field padding13:Short, padding14:Short, padding15:Short, padding16:Short
EndType

Type DOCINFOW
	Field cbSize:Int = SizeOf(Self)
	Field lpszDocName:Short Ptr, lpszOutput:Short Ptr, lpszDatatype:Short Ptr
	Field fwType:Int
EndType

Type FORMATRANGE
	Field hdc:Byte Ptr, hdcTarget:Byte Ptr
	Field rcLeft:Int, rcTop:Int, rcRight:Int, rcBottom:Int
	Field rcPageLeft:Int, rcPageTop:Int, rcPageRight:Int, rcPageBottom:Int
	Field CHARRANGE_cpMin:Int, CHARRANGE_cpMax:Int
EndType

-Henri

Baggey

I came up with this  :-X

SuperStrict

Import maxgui.drivers

Local window:Tgadget=CreateWindow("Test",0,0,256,256)
Local gadget:Tgadget=CreateTextArea(0,0,128,22,window)


SetGadgetLayout( gadget, 0, 0, 128, 16 )

	
ActivateGadget( gadget )

SetGadgetText(gadget,"testing")


While Not AppTerminate() And Not KeyDown(Key_Escape)


Wend
Running a Pc that just aint. Faster nough. I7-4Ghz, 32Gb Ram, 4Gb Nvidia, 2 x 1Tb SSD's, 2 x 24" LCD's

RETRO everything!

Jesus was only famous because of his Dad