def doOnEnter(self, sender): umain.TMainForm(self.Owner).enteringAParameterPanel(self) if umain.TMainForm(self.Owner).backTabbingInParametersPanel: self.selectedItemIndex = self.maxSelectedItemIndex() umain.TMainForm(self.Owner).backTabbingInParametersPanel = false if self.selectedItemIndex == kItemNone: self.selectedItemIndex = kItemLabel self.Invalidate()
def collapseOrExpand(self, y): if y > self.collapsedHeight(): return if self.param != None: if not self.param.collapsed: self.collapse() else: self.expand() if (self.Owner != None) and (not umain.TMainForm(self.Owner).internalChange): umain.TMainForm(self.Owner).repositionParameterPanels()
def collapseOrExpand(self, y): if (self.Owner != None): umain.TMainForm( self.Owner).collapseOrExpandParameterPanelsUntilNextHeader( self) #don't need to change height self.param.collapsed = not self.param.collapsed
def expand(self): if not self.param.collapsed: return if (self.Owner != None): umain.TMainForm( self.Owner).collapseOrExpandParameterPanelsUntilNextHeader( self) self.param.collapsed = false
def maxWidth(self): result = 0 i = 0 maxWidth = 0 result = 0 for i in range(0, self.choiceStrings.Count): result = umath.intMax( maxWidth, umain.TMainForm(self.Owner).Canvas.TextWidth( self.choiceStrings.Strings[i])) result = umath.intMax( uppanel.kLeftRightGap * 2 + self.labelWidth, +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth + uppanel.kRadioButtonBeforeTextGap + maxWidth + uppanel.kLeftRightGap) return result
def minWidth(self, requestedWidth): result = 0 i = 0 longestWidth = 0 minAllowed = 0 longestWidth = 0 for i in range(0, self.choiceStrings.Count): longestWidth = umath.intMax( longestWidth, umain.TMainForm(self.Owner).Canvas.TextWidth( self.choiceStrings.Strings[i])) minAllowed = umath.intMax( uppanel.kLeftRightGap * 2 + self.longestLabelWordWidth, +uppanel.kRadioButtonLeftGap + uppanel.kRadioButtonWidth + uppanel.kRadioButtonBeforeTextGap + longestWidth + uppanel.kLeftRightGap) if requestedWidth > minAllowed: result = -1 else: result = minAllowed return result
def doKeyDown(self, sender, key, shift): Form = TCustomForm() if (key == delphi_compatability.VK_TAB): if shift == [delphi_compatability.TShiftStateEnum.ssShift, ]: # subclasses should override and respond to enter events when different items are selected # subclasses should call inherited self.tabThroughItems(false) else: self.tabThroughItems(true) if self.selectedItemIndex == kItemNone: Form = UNRESOLVED.getParentForm(self) if Form != None: if shift == [delphi_compatability.TShiftStateEnum.ssShift, ]: umain.TMainForm(Form).backTabbingInParametersPanel = true #previous Form.Perform(UNRESOLVED.wm_NextDlgCtl, 1, 0) else: Form.Perform(UNRESOLVED.wm_NextDlgCtl, 0, 0) elif (key == delphi_compatability.VK_RETURN) and (self.selectedItemIndex == kItemLabel): #give it a y as if the label was clicked on self.collapseOrExpand(0) return key
def doOnExit(self, sender): umain.TMainForm(self.Owner).leavingAParameterPanel(self) self.selectedItemIndex = kItemNone self.Invalidate()