PDA

View Full Version : Help needed with some things



KANUSO
12-08-2018, 12:17 AM
I want to be able to open some requesters but do not find any hints in the docs.

This are:
A file requester. Yes, I am Aware of LWFileReqFunc, but I do not find any hint in the docs. With this function I am able to open a load or save requester. But how can I tell it how he has to work?
How it must be done with LWFileActivateFunc?
I looked in the C include files and the C examples. But I found no Counterpart of the c-func "global" and so I am not able to reconstruct this in Python.

A Folder requester. This is of sure be done with the file requester. but if I am not able to do it with LWFileActivateFunc, I have no Chance to use one for Folders.

A Color Picker requester. The same Problem as with the other requesters. How it must be done with the LWColorActivateFunc?


And a question...
Can the mousepointer be changed? For example if the mouse hovers a Input control, it changes to the beam-Cursor. How can this be done?

It would be great if someone can help me with that.

Regards,
Kanuso

oliverhotz
12-08-2018, 08:59 AM
filerequester: in its most simple form (simple load/save):

tmppath = r"c:\temp"
path = lwsdk.LWFileReqFunc( "save a text file" , ".txt" , tmpPath )

filerequester with more control (hope this will get you started):

reqlocal = lwsdk.LWFileReqLocal
reqlocal.reqType = lwsdk.FREQ_MULTILOAD
reqlocal.result = -1
reqlocal.title = "Select all Object Files."
reqlocal.fileType = lwsdk.LWFTYPE_OBJECT
reqlocal.path = lwsdk.LWDirInfoFunc('Content') + os.sep + "Objects"
reqlocal.baseName = "*"
reqlocal.fullName = ""

result = lwsdk.LWFileActivateFunc(lwsdk.LWFILEREQ_VERSION, reqlocal, self.pick_name)
if result == lwsdk.AFUNC_OK:
if reqlocal.result == 1:
if reqlocal.reqType == lwsdk.FREQ_MULTILOAD:
... and so on....

EDIT: obviously the indents are wrong at the bottom, but not sure how to make it take them.. they are fine when i edit the post

KANUSO
12-08-2018, 12:22 PM
Thank you Oliver, this helps a lot. I am now able to work wit the filerequesters.

But with the ColorPicker seems to be a Problem. In some C related docs i found a LWColorActivateFunc, but python seems not to know this function. If I do a

help("lwsdk.LWColorActivateFunc")

Python does not find this function.

running the following in the script
result=lwsdk.LWColorActivateFunc(lwsdk.LWCOLORPIC_ VERSION,creql)
leads to a AttributeError: 'module' object has no Attribute 'LWColorActivateFunc'

So it seems that there is no equivalent to the filerequester. So I must go an other way to reach the Color Picker. I think about to use a Color Control. This is not exactly what I want, but if the ActivateFunc is missing, there is no other Chance.

Again thank you for helping me. The hint with the Filerequesters was a 100% success.

Regards,
Kanuso

oliverhotz
12-08-2018, 01:14 PM
I always just use the color ctrl for that. however, when you find something thats not wrapped in python, but exists in the c sdk.. definitely report it.