inputbox with 3 buttion?

inputbox with 3 buttion?

Darkforce_the_ilogic_guy
Advisor Advisor
812 Views
8 Replies
Message 1 of 9

inputbox with 3 buttion?

Darkforce_the_ilogic_guy
Advisor
Advisor

 

 

 

myparam = InputBox("Prompt", "Title", "DD-MM-YYYY",MessageBoxDefaultButton.Button1)

oDate3 = New DateTime(Right(myparam, 4), Mid(myparam, 4, 2), Left(myparam, 2), 0, 0, 1)	

I have this code now 

 

But I would like to have make my code .. so I click ok  it will take the date enter in to inputbox like today 17-09-2024 (userinput)

 

 

if user click Cancel exis sub

 

and a 3. buttom Call Full Review  then it should be like if the user have enter 01-01-2000 no matter what is in the inputbox 

 

se this possible with Ilogic =

0 Likes
813 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor
you could create your own Inputbox with vb.net and than reference this .dll file to your i-logic code!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 9

daltonNYAW9
Advocate
Advocate

Heres an example

'Imports System.Windows.Forms
Class UserSetsForm
	Inherits System.Windows.Forms.Form
	Private WithEvents oForm As New Form
	Dim Button1 As New Button()
	Dim Button2 As New Button()
	Dim Button3 As New Button()
	Dim tb As New TextBox()
	Sub Main
		oForm = Me
		With oForm
			' Set up form	
			.FormBorderStyle = FormBorderStyle.FixedToolWindow
			.StartPosition = FormStartPosition.CenterScreen
			.Width = 600
			.Height = 200
			.TopMost = True
			.Text = "Custom Form"
			.Name = "Custom Form"
		End With

		With Button1
			'.Font = myfnt
			.Text = "OK"
			'.Width = 100
			'.Height = 100
			.Top = 25
			.Left = 25
			.Enabled = True
		End With

		With Button2
			'.Font = myfnt
			.Text = "Cancel"
			'.Width = 100
			'.Height = 100
			.Top = 25
			.Left = 125
			.Enabled = True
		End With

		With Button3
			'.Font = myfnt
			.Text = "Button 3"
			'.Width = 100
			'.Height = 100
			.Top = 25
			.Left = 225
			.Enabled = True
		End With

		
		tb.TextAlign = HorizontalAlignment.Right
		tb.Height = 20
		tb.Width = 100
		tb.top = 100
		tb.Left = 100
		tb.Text = "DD-MM-YYYY"
		oForm.Controls.Add(tb)

		'Add your Event handler
		AddHandler Button1.Click, AddressOf Button1_Click
		AddHandler Button2.Click, AddressOf Button2_Click
		AddHandler Button3.Click, AddressOf Button3_Click

		oForm.Controls.Add(Button1)
		oForm.Controls.Add(Button2)
		oForm.Controls.Add(Button3)

		test = oForm.ShowDialog
		MessageBox.Show(test.ToString, tb.text)

	End Sub

	Private Sub Button1_Click(ByVal sender As System.Object, ByVal E As System.EventArgs)
		oForm.dialogResult = DialogResult.OK
		sender.Parent.Close
	End Sub

	Private Sub Button2_Click(ByVal sender As System.Object, ByVal E As System.EventArgs)
		oForm.dialogResult = DialogResult.Cancel
		sender.Parent.Close
	End Sub
	
	Private Sub Button3_Click(ByVal sender As System.Object, ByVal E As System.EventArgs)
		oForm.dialogResult = DialogResult.Cancel
		sender.Parent.Close
		tb.Text = "01-01-2000"
	End Sub

End Class
Message 4 of 9

Darkforce_the_ilogic_guy
Advisor
Advisor

You clearly know some of this stuff .. maybe you could also help with this soo. I want to add some buttom that into this one ... each buttom run an ilogic code..  I have it as VBA today , but I would it it to this windows , because in the dock inside inventor  🙂  but have no idear how to add any buttom into it 

Dim oUserInterfaceMgr As UserInterfaceManager
         oUserInterfaceMgr = ThisApplication.UserInterfaceManager

        ' Create a new dockable window
        Dim oWindow As DockableWindow
        oWindow = oUserInterfaceMgr.DockableWindows.Add("SampleClientId9", "TestWindowInternalName9", "Test Window9")

        ' Get the hwnd of the dialog to be added as a child
        ' CHANGE THIS VALUE!
        Dim hwnd As Long
        hwnd = 4851096

        ' Add the dialog as a child to the dockable window
        oWindow.AddChild(hwnd)' Her I would Like To add a UserControl Or Userfrom!!!!!

        ' Don't allow docking to top and bottom
        oWindow.DisabledDockingStates = DockingStateEnum.kDockTop And DockingStateEnum.kDockBottom

        ' Make the window visible
        oWindow.Visible = True

 

0 Likes
Message 5 of 9

WCrihfield
Mentor
Mentor

Hi @Darkforce_the_ilogic_guy.  I have used a trick to put various dialogs into a DockableWindow before, but it is not usually a very good result.  There is a vb.net function that I include in my code that is used in the process to get the numerical handle of a dialog window by its 'caption'.

 

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal ClassName As String, ByVal WindowName As String) As Long

 

That function separate from the 'Main' routine, and is called (used) within the 'Main' routing to get the handle of the dialog, by the caption of the dialog.  Then, once I have a reference to the DockableWindow I want to put it in, I specify that handle in the AddChild method.

 

I have used that trick to put simple internal or global iLogic forms into a DockableWindow, and have also put the parameters dialog into one.  Usually not the best way to go for any sort of long term solution, but simply shows what is possible.  The following is an example that shows a 'global' iLogic Form named "Basic Properties", then puts it into a DockableWindow.  I believe I posted this in another forum topic before, but lost the link to it.  It's not necessarily a 'new' process though.

 

'Imports System.Windows.Forms
Sub Main
	Dim sFormName As String = "Basic Properties"
	Dim sWindowInternalName As String = "Basic Properties" 'this MUST be unique
	Dim oDWs As Inventor.DockableWindows = ThisApplication.UserInterfaceManager.DockableWindows
	Dim iLogicClassIDString As String = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"
	Dim oDW As Inventor.DockableWindow = Nothing
	Try
		oDW = oDWs.Item(sFormName)
	Catch
		oDW = oDWs.Add(iLogicClassIDString, sFormName, sFormName)
		oDW.DisableCloseButton = False
		oDW.ShowVisibilityCheckBox = True
		'oDW.SetMinimumSize(100, 200)
		oDW.SetDockingState(DockingStateEnum.kDockLastKnown)
		oDW.Visible = True
	End Try
	Try : iLogicForm.CloseGlobal(sFormName) : Catch : End Try
	Dim oFRV As FormReturnValue = iLogicForm.ShowGlobal(sFormName, FormMode.NonModal)
	Dim oHandle As Long = FindWindow(vbNullString, sFormName)
	oDW.Clear 'remove previous form from window, if any
	oDW.AddChild(oHandle) 'add current form to the window
End Sub

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal ClassName As String, ByVal WindowName As String) As Long

 

Edit:  Found topic, adding link:

https://forums.autodesk.com/t5/inventor-programming-ilogic/how-to-pin-open-form-window-to-the-interf... 

There are several other discussions on this forum about pretty much the same thing though.  If you do a search on this forum, you will see several similar results, many of which have accepted solutions.  Not sure if any involve adding a VBA UserForm into an Inventor DockableWindow specifically though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 6 of 9

Frederick_Law
Mentor
Mentor

"Buttons" in iLogic Global form:

iLogicGlobalForm-01.jpg

0 Likes
Message 7 of 9

daltonNYAW9
Advocate
Advocate

Global forms seem like the way to go. I've never found a good enough reason not to just use the built in form/rule functionality. Although, people on here that know a lot more than me swear by add-ins.

I had to add these two lines to attach the form to the above mentioned dockable window

oForm.Show
oDW.AddChild(oForm.Handle.ToInt64())

 

0 Likes
Message 8 of 9

Darkforce_the_ilogic_guy
Advisor
Advisor

I don´t Global forms  is the way to go unless it have been change sind the ealy version of inventor. or  there is a way to change how they work. Last time I try to use globol it Lock into the files the was active at the time I active the form ... the problem is that I want to keep the my form open and always run on the aktive document.. same time that I can work freely in inventor. I can do this with VBA but as far as I know  I can´t with globel form.  And I dont think globel form can dock in inventor(might be wrong it have been years sind i work with globol form). and I still need both 

0 Likes
Message 9 of 9

WCrihfield
Mentor
Mentor

You are correct.  When we launch an iLogic global form, it will remain focused on the document that was 'active' when that form was first launched, even if you open other documents while it remains open.  So, if you 'need' to use a global iLogic form, but also 'need' it to shift its focus to another document, then you will need to close that global iLogic form, then show it again, while the document you want it to fucus on is currently the 'active' document in Inventor.  When using other types of forms, we have more control over them, and can force them to shift their focus from one document to another, when certain actions/events happen, while keeping the form open.  In the 2024 version of Inventor, we got the ability to 'Close' an iLogic Form that is currently open.

iLogic Enhancements (What's New in 2024) 

If we launched an iLogic Form to show with an iLogic rule, we can then also monitor for when, and how that form was closed, so that the same rule that launched it, can react appropriately to how the form was closed, if needed.  Most folks do not pay attention that the 'iLogicForm.ShowGlobal' method is actually a Function, not just a Sub, so it actually returns something...a FormReturnValue.  That object has 2 properties...Result & RuleName.  The 'Result' property returns a FormResult, which is a variation of an Enum which tells us how the form was closed.  The 'RuleName' property is a String, but only relevant when 'FormResult' was one of the two variations that involved an iLogic rule button getting clicked within the form, as the reason for the form closing, and tells us the name of the rule that got ran by the rule button involved.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes