Jump to content

Tjalve

Active Members
  • Posts

    247
  • Joined

  • Last visited

Recent Profile Visitors

223 profile views

Tjalve's Achievements

Polymath

Polymath (5/7)

0

Reputation

  1. Hi again i almost got it to work. The problem im having now is That i need to use _GUICtrlTreeView_AddChild in order to get the icons working (just as AutoBert did in his example). The problem with that is that my fuction to have some actions when an item is selected, no longer works. I think i actullt got some help with this from the forum the last time i tried to do this. Becuase when i select something i need thing A to happen, based on what is selected. I got that working with the help from someone here in forums. To be honest, this is a little bit outside my comfort zone sinze i dont really understand how these actions work. But there is a function called "_WM_NOTIFY" thats used. Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam ; Create NMTREEVIEW structure Local $tStruct = DllStructCreate("struct;hwnd hWndFrom;uint_ptr IDFrom;INT Code;endstruct;" & _ "uint Action;struct;uint OldMask;handle OldhItem;uint OldState;uint OldStateMask;" & _ "ptr OldText;int OldTextMax;int OldImage;int OldSelectedImage;int OldChildren;lparam OldParam;endstruct;" & _ "struct;uint NewMask;handle NewhItem;uint NewState;uint NewStateMask;" & _ "ptr NewText;int NewTextMax;int NewImage;int NewSelectedImage;int NewChildren;lparam NewParam;endstruct;" & _ "struct;long PointX;long PointY;endstruct", $lParam) If DllStructGetData($tStruct, "hWndFrom") = $idTV Then Switch DllStructGetData($tStruct, "Code") ; If item selection changed Case $TVN_SELCHANGEDA, $TVN_SELCHANGEDW Local $hItem = DllStructGetData($tStruct, "NewhItem") ; Set flag to selected item handle If $hItem Then $hItemSelected = $hItem EndSwitch EndIf EndFunc This works when i use $idTV = _GUICtrlTreeView_Create($hGui, $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30) But not if i use: $idTV = GUICtrlCreateTreeView( $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30, -1, $WS_EX_CLIENTEDGE ) Resizing works, icons works. But nothing happens when i select something. So to build on my previous example. This is what I would like to do. This obviously does not work. But i would like to learn how to make it work #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 208, 220, 192, 124,$WS_SIZEBOX) ;~ $idTV = _GUICtrlTreeView_Create($Form1, 4, 25, 200, 140) $idTV = GUICtrlCreateTreeView(4, 25, 200, 140) $idRoot = _GUICtrlTreeView_Add($idTV, 0, "Root") $child1 = _GUICtrlTreeView_AddChild($idTV,$idRoot,"Child1") $child2 = _GUICtrlTreeView_AddChild($idTV,$child1,"Child2") _GUICtrlTreeView_Expand($idTV) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $idTV MsgBox(0,"","Some kind of action when i select one of the child objects") EndSwitch WEnd
  2. Clearly there has been some development on this since i last worked on it. I appreciate the help and the code examples and i will read it thoroughly and report back if i got everything to work. Thank you both AutoBert and spudw2k.
  3. Im using several functions form the UDF. See list below. So you are saying that i could use these functions with the native function? That would be ideal if course. If so, how? _GUICtrlTreeView_SetNormalImageList _GUICtrlTreeView_Expand _GUICtrlTreeView_DeleteAll _GUICtrlTreeView_GetSelection _GUICtrlTreeView_GetParentHandle _GUICtrlTreeView_Add _GUICtrlTreeView_AddChild
  4. I know that. But since i use a lot of the functionality from _GUICtrlTreeView_Create, i cannot just switch.
  5. Hello fellow coders. Im currently making a GUI for a webapp. Im using a REST API to get information and display this in a Tree view. Its basically a scheduler of "tasks" and these tasks are great to display in a tree view. The problem im having is that on some servers the tree can get rather large. So my GUI is reziable in ordet to be able to fit all the tasks in the view. I have then used GUICtrlSetResizing with diffrent options to get the GUI to look alright even when i resize it. It works fine an all GUI elements, except for the Tree-view. And if i remember correctly, the treeview item is another type of object and you cannot use regular GUI functions on it. Therefor im wondering of there are any alternatives? #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <GuiTreeView.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 208, 220, 192, 124,$WS_SIZEBOX) $idTV = _GUICtrlTreeView_Create($Form1, 4, 25, 200, 140) GUICtrlSetResizing(-1,$GUI_DOCKMENUBAR) $Button1 = GUICtrlCreateButton("Button1", 8, 168, 75, 25) GUICtrlSetResizing(-1,$GUI_DOCKSTATEBAR) $Text = GUICtrlCreateLabel("Text", 8, 8, 25, 17) GUICtrlSetResizing(-1,$GUI_DOCKMENUBAR) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd This code is an example of my problem (run it and try to resize the window). If anyone has any ideas i would appreciate it
  6. I applaud you sir! Simple and understandable explanation. As i said, I probably would not be able to write it myself (maybe if i copy and paste some of your code :P). But now, atleast i understand whats going on. Great summary and many thanks!
  7. Hi Melba23 and thank you for your replay. That work flawlessly! However i still dont really understand. I can deffenently use your code (and i will) but it would be nice to unerstand what is happening. If i understand it correctly, the UDF fuctions doesnt return a ControlID, but a handle. I suspect there is a good reson for it, but thats boyond my understanding. Anyways, To use Switch and GuiGetMsg() i need a controlID. And since the function does not return one, it wont work. In your case you are using an IF-statement to check if the itemselected varible has changed. What i dont understand is how that varible change. I see your function and I see some kind of DLL call ore something. But there is no way i would be able to write that myself. So is there some kind of logic to it? Thank you again for your assistance?
  8. Hi everyone. Im creating a GUI for an application. Im usinga treeview item and i want to add some information to the side of the treeview based on what cilditem you are pressing. For the moment i have a "get info" button that works. But that means that you have to select your child in the treeview, and then press a button to gte the info. I want the info to be visable as soon as you select it. With uther controls you can just add it to the loop but it doesnt seem to work with tyhe UDF version of the treeview control. Is there anything I can do? #include <GUIConstantsEx.au3> #include <GuiTreeView.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> ;~ Create GUI dim $guilabel[7] local $currentlevel = 1 Local $hGui = GUICreate( "Grejs", 1000, 500, 600, 300, BitOR( $GUI_SS_DEFAULT_GUI, $WS_MAXIMIZEBOX, $WS_SIZEBOX ) ) Local $iBorderWidth = 4, $aPos = WinGetClientSize( $hGui ) $idTV = _GUICtrlTreeView_Create($hGui, $iBorderWidth, $iBorderWidth, $aPos[0]-2*$iBorderWidth-400, $aPos[1]-2*$iBorderWidth-30 ) $root_level = _GUICtrlTreeView_Add($idTV,0,"Root") $item1 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child1") $item2 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child2") $item3 = _GUICtrlTreeView_AddChild($idTV, $root_level, "child3") ;~ Start Gui GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idTV MsgBox(0,"","") EndSwitch WEnd GUIDelete($hGui) Exit In this example, i want the msgbox to appear whenevr i select something in the treeview. It ios not my full code, but its an example of the problam i have. Help is much appritiated /G
  9. Hi everyone. Im trying to use this UDF to get a REST API working (for Qliksense). And in doing that i need to supply a client certificate in my webrequest and i was wondering if someone could help me withe some sample code to get me started? Acording to this, it should be possible to use a certificate for from the local store. I would prefer using a .pem file or .pfx file if possible. https://msdn.microsoft.com/en-us/library/windows/desktop/aa384076(v=vs.85).aspx?f=255&MSPPError=-2147217396 Here is an example in the documattion for the API: https://help.qlik.com/en-US/sense-developer/2.2/Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Example-Connect-DotNet-Certificates.htm Any help would be appritiated. This is the code i got so far: $hopen = _WinHttpOpen("Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0") $hconnect = _WinHttpConnect($hopen,"servername",4242) $hRequest = _WinHttpOpenRequest($hconnect,"GET","/header_api/qrs/app/?Xrfkey=0123456789abcdef") _WinHttpAddRequestHeaders($hRequest,"Content-Type: application/json") _WinHttpAddRequestHeaders($hRequest,"x-qlik-xrfkey: 0123456789abcdef") _WinHttpAddRequestHeaders($hRequest,"X-Qlik-User: UserDirectory=internal;UserId=sa_repository") _WinHttpSendRequest($hRequest) $svar = _WinHttpReceiveResponse($hRequest) Local $Header = _WinHttpQueryHeaders($hRequest) Local $Data = _WinHttpSimpleReadData($hRequest) ConsoleWrite($Header & @CRLF) ConsoleWrite($Data & @CRLF)
  10. Hi. Ive tried to get this to work with a script i currently have. I compiled the examle and ran it from command line. Nothing happend so i tried a few diffrent commands and tried to get it to work. Suddenly i had 2 diffrent services. One of them i could remove by just switching -i to -u But now i have another service that i cannot remove. Is there another way to "manually" remove the service?
  11. Alright ive made some progress. Using "Msxml2.XMLHTTP.6.0" sitead, ihave been able to get the info i need using basic authentication. The question now if i can make it to use windows authentication? Since i dont want to save the password in clear text, i prerfer to use the current logged on users credentials. Any idéa on how to do that? My vode so far: $objHTTP = ObjCreate("Msxml2.XMLHTTP.6.0") $objHTTP.open ("GET", "http://localhost/qrs/app/?Xrfkey=ABDHEFUELPYRVGLK", False,"my usernamer","my password") $objHTTP.setRequestHeader("X-Qlik-Xrfkey","ABDHEFUELPYRVGLK") $objHTTP.send() $data = $objHTTP.responseText ConsoleWrite($data & @CRLF)
  12. Hello my fellow coders. At my company we have an installation of a BI-solution called QlikSense (next generation of Qlikview if anyonw knows about it). In Qliksense i have several tasks that extract data from varius sources and display them as graphs and tables on a dashboard. The entire system is based on websockets (im not 100% sure what websockets actually is though...). Anyways, I now have a need to externaly trigger theese reload tasks and this can be done using the QlikSense management API (http://help.qlik.com/sense/2.1/en-us/developer/#../Subsystems/RepositoryServiceAPI/Content/RepositoryServiceAPI/RepositoryServiceAPI-Connect-API.htm) This API uses REST to send commands and extract information from the Qliksense management console. Since i haven used this kind of API befor, im a bit lost but i have managed to create the following code: $objHTTP = ObjCreate("winhttp.winhttprequest.5.1") $objHTTP.open ("GET", "http://localhost/qrs/user/count", False) $objHTTP.setRequestHeader ("Content-Type", "application/json") $objHTTP.setRequestHeader("Accept","application/json") $objHTTP.setRequestHeader("x-qlik-xrfkey","0123456789abcdef") $objHTTP.send() ConsoleWrite($objHTTP.responseText & @CRLF)This is supposed to return all the users of the Qliksense enviroment, in JSON format, but the only thing i get is a HTML-based code. If i save that to a html file, and open it, i get a logon page. So i guess there is a problem with authentication. I checked the examples in the API documentation and also the topping on authentication. It say that if the sender supports it, the system should uyse standard windows authentication without any need for username/password or certificates. If i just use the standard URL http://localhost/hub i get into the system withut logging on. ANY help would be appritiated. Perhaps someone understands the documentation better then I do?
  13. You might me right. Well i hope they will check this thread then. Thank you again for your assistance
  14. Yes. Same result: "C:\Users\xxxxxxxxxx\Documents\autoit\Qlikview_COM\qlikview_test_error.au3" (47) : ==> The requested action with this object has failed.: $values = $qv_documentobject.Fields($field).GetPossibleValues($numberofreturns) $values = $qv_documentobject.Fields($field)^ ERROR However, if i use this it works (@error is 0 and @exended is also 0). But it works. func _qv_field_GetPossibleValues($qv_documentobject,$field,$numberofreturns=100) Local $oMyError_local = ObjEvent("AutoIt.Error","MyErrFunc_SECOND") Local $oField = $qv_documentobject.Fields($field) If IsObj($oField) = 0 Then MsgBox(0, 'VarGetType($oField ) = ' & VarGetType($oField ) & @CRLF & 'VALUE = '& $oField , '@error = ' & @error & @CRLF & '@extended = ' & @extended) Exit EndIf $values = $qv_documentobject.Fields($field).GetPossibleValues($numberofreturns) local $array[$values.count + 1] $array[0] = $values.count for $i = 0 to $values.count - 1 $array[$i+1] = $values.Item($i).Text Next return $array EndFuncThis is a workaround that works ok, but i would still like to know why my COM error handler cant cacth the error... many thanks for the tip for the workaround!
  15. No one whos got any idée? I would really like to learn the reson for this error.
×
×
  • Create New...