Page 1 of 1

not working

Posted: Fri Mar 07, 2025 11:18 am
by moricode

Code: Select all

Working:

Txt$ = "ABC XYZ"

 DrawText_(hdc,@Txt$,-1,RC, Text_Align | #DT_NOPREFIX )
NOT Working:

Code: Select all

Not working:

Newlist T$()

Addelement(T$())
T$()="ABC XYZ"

 DrawText_(hdc,@T$(),-1,RC, Text_Align | #DT_NOPREFIX )


Re: not working

Posted: Fri Mar 07, 2025 11:54 am
by miso
None of these examples (working or not) shows anything to me when I run them. Can't confirm.
If I output the results in a console window (as a short check), I see the addresses.

Re: not working

Posted: Fri Mar 07, 2025 12:10 pm
by NicTheQuick
`@T$()` does not give you the pointer to the string but to the list element itself, so you can use it with `ChangeCurrentElement()` for example.
You can fix it like this:

Code: Select all

NewList T$()

AddElement(T$())
T$()="ABC XYZ"

Debug PeekS(PeekI(@T$()))
So first retrieve the pointer to the field that contains the string. And then you can use that pointer to with the Windows API.
But be aware that an unset string results in a null pointer as you can see here:

Code: Select all

NewList T$()

AddElement(T$())

Debug PeekI(@T$())
In case you want to use a structure with the LinkedList, it would look like this:

Code: Select all

Structure T
	s.s
EndStructure
NewList T.T()

AddElement(T())
T()\s = "ABC XYZ"

Debug PeekS(@T()\s)

Re: not working

Posted: Fri Mar 07, 2025 12:10 pm
by NicTheQuick
Oh, and please update the titel of this thread. "not working" is not very helpful.